TP-Link Smartplug: Could not connect to

Hello,
I have connected a TP-Link P100 socket to each of my printers and wanted to control them via the "TP-Link Smartplug" plugin, but I get the error:

[2022-02-17 08:40:11,365] DEBUG: {'system': {'get_sysinfo': {'relay_state': 3}}, 'emeter': {'err_code': True}}
[2022-02-17 08:40:12,722] DEBUG: ImmutableMultiDict([('checkStatus', '192.168.178.171')])
[2022-02-17 08:40:12,722] DEBUG: Checking status of 192.168.178.171.
[2022-02-17 08:40:12,735] DEBUG: {'system': {'get_sysinfo': {}}
[2022-02-17 08:40:12,736] DEBUG: IP 192.168.178.171 is valid.
[2022-02-17 08:40:12,736] DEBUG: Sending command {'system': {'get_sysinfo': {}} to 192.168.178.171
[2022-02-17 08:40:12,742] DEBUG: Could not connect to 192.168.178.171.

Is there a solution for this?

While 192.168.178.171 is a valid IP address, you haven't given us enough information to determine if it is a valid address on your Local Area Network (LAN).

Please SSH into your system and provide the output of ifconfig. Verify that your local IP address is in the same netblock (i.e. 192.168.178.* with a netmask of 255.255.255.0).

The TPLink plugins don't support Tapo devices IIRC.

Try GitHub - Tyfy/OctoPrint-TapoSmartplug

1 Like

Thank you for your reply and the link to github! I will give it a try

I'm seeing this error as well. I have a KP303. Goes through and states that IP 10.8.63.65 is valid. But then gives the error:

DEBUG: Sending command {'system': {'get_sysinfo': {}}} to 10.8.63.65
DEBUG: Could not connect to 10.8.63.65

I can ping this address as well as control the strip from the Kasa app. What would cause the plugin not to connect to it?

Might need to include the plug id after the ip, ie 10.8.63.65/1.

That's actually how it's configured. The debug log starts with:

Checking status of 10.8.63.65/2

Then I get...

IP 10.8.63.65 is valid.

Could be firmware related, what version is your firmware? I use this exact model personally.

Firmware version is 1.0.6. Hardware version 2.0.

Actually looks like mine is a HS300 hardware version 1.0 firmware version 1.0.19. Does your device use the tapo or kasa app for control?

I did a quick search on the github repo and there are users using the kp303 though, that's why I list it as supported.

The Kasa app which controls the switch with no issues. Not sure why the plugin would not connect. The icons for the controls just spins in Octoprint.

Any additional troubleshooting that can be done? Anything from a wireless/networking standpoint that would prevent the plugin from connecting to the strip?

There is potentially what's known as AP Isolation mode that would prevent wireless devices from connecting to wired/other wireless devices on the network, but I think that would also impact your access to the Pi from other devices on the network as well. If you're not seeing errors in octoprint.log or plugin_tplinksmartplug_debug.log outside of what you've already shared narrowing down the issue will be difficult. It could also be TPLink deciding to block local access the way they did on one firmware push to the UK devices at one point.

It could also be a routing issue if the two devices are connecting to different radio frequencies (2.4GHz vs 5GHz). I have seen in some cases where I can't access OctoPrint when not on the same frequency, which is a router issue, and sometimes gets resolved with restarting the router.

It seems that my issues may have been network related. When I ssh into the Raspberry Pi, I noticed that there were several IPs that I could not ping. When I ran an arp -n, I saw an (Incomplete) finding the MAC addresses. Rebooted my switch and change the DHCP scope to exclude the address of the Pi and the TPLink strip. I can now communicate to them!!! Thanks much for pointing me in the right direction.

Glad you figure it out. I was definitely thinking it was network related. That happens at home for me occasionally as well.

Ahh....and what do you end up doing, just restart?

Yeah, typically a router restart fixes it. It didn't happen often though.