Tapo P100 or Tenda bell Sp3 power control

Basic Information:

Printer Model: Moded Ender 3v2
MCU / Printerboard: creality v4.2.2
klippy.log

Describe your issue:

HI All,

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

See https://github.com/Arksine/moonraker/blob/master/docs/configuration.md#power

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.

I do not know this device but in general:

  1. Moonraker natively supports only the devices as listed
  2. Depending on your TP Link Firmware the device may work or not
  3. You can control any device as long as the device supports some general protocols, e.g.

Just for the fun of it: GitHub - nohous/tenda-beli: Tenda Beli SP3 Smart Plug Python Control Library

This suggests that this plug could be controlled via http with a bit of tinkering, so it might work with generic-http-devices

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 %}
1 Like