With Octoprint i could start and stop my printer with the Tenda Bell Smart SP3. But can’t see how to do it with Klipper/Moonraker. I did look at the relevant documentation but either missed it or not sure how to adapt the configs for this smart plug.
I also have Tapo P100 smart plug which I could also switch to for the printer. But again couldn’t get this one to work even with Octoprint hence the Tenda.
I also know I need to add a fix to get the MCU to restart when the printer powers on. But it’s the basic on/off with print up load and ending I am after.
I have seen there is something in python what can be done. But do not understand how to apply this to my Pi and Klipper/moonraker configs
Thanks Sineos,
But this calls out the TPlink as having issues. But doesn’t mention the tenda plugs unless you or others know which mechanism this one uses.
Hi, I wrote a config snippet for Tenda Beli SP3. You should add this snippet to your moonraker.conf file. Remember to substitute 192.168.1.61 with the ip of your SP3 device.
[power printerTendaBeliSP3]
type: http
on_url: http://192.168.1.61:5000/setSta
off_url: http://192.168.1.61:5000/setSta
status_url: http://192.168.1.61:5000/getSta
request_template:
{% if command in ["on", "off"] %}
{% do http_request.set_method("POST") %}
{% do http_request.add_header("Host", "192.168.1.61") %}
{% do http_request.add_header("Connection", "Keep-Alive") %}
{% do http_request.add_header("Accept-Encoding", "gzip") %}
{% do http_request.add_header("User-Agent", "okhttp/3.10.0") %}
{% if command in ["on"] %}
{% do http_request.set_body({"status": 1}) %}
{% endif %}
{% if command in ["off"] %}
{% do http_request.set_body({"status": 0}) %}
{% endif %}
{% endif %}
{% do http_request.send() %}
response_template:
{% if command in ["on", "off"] %}
{% do http_request.set_method("GET") %}
{% do http_request.set_body(None) %}
{% do http_request.set_url(urls.status) %}
{% set response = http_request.send() %}
{% do response.raise_for_status() %}
{% endif %}
{% set resp = http_request.last_response().json() %}
{% if resp["data"]["status"] in [0] %}
{"off"}
{% else %}
{"on"}
{% endif %}