Tapo P100 smart plug

I am trying to use the Tapo P100 library from Almottier while using the node-red-contrib-pythonshell.

I am able to turn the Tapo P100 ON and OFF but I don't understand how to read the state of the P100. From p100.getDeviceInfo() I see
<PyP100.PyP100.P100 object at 0x7f9bc5ef60>
from a debug node.

Can anyone help me determine the P100 state from this hex string please?

After sending a turn ON instruction I would like to check the true status of the P100 and if necessary resend an ON instruction, the same with the OFF instruction.

Thank you

Hi. If that hexadecimal value really does contain state and you know which bits/bytes to extract I can certainly help you Parse it quite easily, however, before travelling that path, have you tried: https://www.npmjs.com/package/node-red-contrib-tplink-tapo-connect-api?

I see it supports p100 and has a status node :woman_shrugging:

Hi, thanks for getting back. I have tried the link you suggested but it didn't work for me. I think I've tried every available node so can't remember exactly why it didn't work.

If i turn the P100 ON and then read the deviceInfo 3 times these are the responces.

{"payload":"<PyP100.PyP100.P100 object at 0x7faad7ef60>\n","_msgid":"0959d8fb50789ca7"}
{"payload":"<PyP100.PyP100.P100 object at 0x7fb5b7ef60>\n","_msgid":"9bddab8b032c0141"}
{"payload":"<PyP100.PyP100.P100 object at 0x7fb2acef60>\n","_msgid":"9438db0c087007aa"}

If I turn the P100 OFF and then read the deviceInfo 3 times these are the responces.

{"payload":"<PyP100.PyP100.P100 object at 0x7fb761ef60>\n","_msgid":"a1c956a23f4e7551"}
{"payload":"<PyP100.PyP100.P100 object at 0x7f8fdaef60>\n","_msgid":"f25691e4b10cb215"}
{"payload":"<PyP100.PyP100.P100 object at 0x7faecdef60>\n","_msgid":"0ee153c9e3a8754a"}

It makes no sence to me.

Thanks

those strings look suspiciously like python memory addresses you see when printing an object instead of its value(s).

At a guess, you are doing something like:

print(p100)

instead of:

info = p100.get_state() # or whatever the function is called!
print(json.dumps(info))

I would strongly suggest you re-try the lib and ask for assistance if you cant get it working. This will avoid ALL of this hassle (and the inevitable problems you will get from spawning python 10000+ times per day/week/whatever)

1 Like

@Steve-Mcl

Thank you for your help this helped no end and I can read the P100 state.

I will retry the lib as you suggest.

At least I understand how to get the state from python even if it's not the most tidy.

FYI I just tried out the node Steve linked to and it works fine for me for my two P110 devices but errors out on my P100.

So I played about using the python library and I noticed that I had to add preferred_protocol="old" option to get a clean result from my P100.

For ref my P100 says firmware version = 1.3.7 Build 20230711 Ref 61904 but my P110s are 1.4.0. all say firmware uptodate

[edit]For anyone else trying out the node - I needed to enable thrid-Party Compatibility in my Tapo app to get it to work using the node or python