Smart plug to allow PI to shut down printer

I want to allow the KASA seriers TPlink P100 smart plug to be controlled by Klipper on my PI.
I have a power button showing on Dashboard but it does nothing.

I read the Kasa series plug should work with Klipper but no luck so far. Anyone have a working setup they can advise me what I am doing wrong or is this just no longer an option with TPlink, and
is there a plug that works?

I can control plug with APP on my smart phone. Should I list the plug’s IP under trusted IPs?

Moonraker.cfg
[power printer]
type: tplink_smartplug
address: 192.168.1.14
restart_klipper_when_powered: True
restart_delay: 3
port: 9999
off_when_shutdown: True
on_when_job_queued: True
locked_while_printing: True

Macros.cfg
[gcode_macro POWER_OFF_PRINTER]
gcode:
{action_call_remote_method(“set_device_power”,
device=“printer”,
state=“off”)}

KLIPPY.LOG 		https://pastebin.ubuntu.com/p/BmBk7M7WFN/
MOONRAKER.LOG	https://pastebin.ubuntu.com/p/CrR9qtRY9J/

TPLINK SMART PLUG
MODEL P100
HARDWARE 1.0.0
FIRMWARE 1.3.6 BUILD 20210827 REL. 37578

STATIC I.P. SET ON ROUTER
NAME WITH ROUTER IS: Tapo_SmartPlug Kasa Series

From your log:

2022-07-04 09:28:30,994 [power.py:init_state()] - Device Init Error: printer
[Errno 111] Connect call failed ('192.168.1.14', 9999)

Never tried this, so only spitballing here:

  • Seems like your plug is not answering to the connection attempt. Are you sure you can control it from remote via this IP and Port?
  • I would not call it printer, since printer is kind of an reserved word, e.g. in Klipper macros etc. Do not know if it makes a difference, though

I’m thinking the answer may lay with this python script.
I just have to figure out how to make it part of my klipper environment or I may be completely wrong.

Looks like, yes: