sanlike0911 / node-red-contrib-tplink-tapo-connect-api

Apache License 2.0
48 stars 20 forks source link

Tapo P100 Error 1003 after Firmeware update 1.2.1 Build 230804 #33

Open mikelle400 opened 1 year ago

mikelle400 commented 1 year ago

After a firmware update to 1.2.1 I can no longer reach my P100 sockets via node red. I get the following error message: errorInf: "Error: Unexpected Error Code: 1003 (undefined)"

A new P100 socket with firmware 1.1.2 runs smoothly. Is the problem known or am I making a mistake?

rjtokenring commented 11 months ago

I have the same exact error. After upgrade, I got error 'errorInf: "Error: Unexpected Error Code: 1003 (undefined)"' Maybe something changed in payload definition

so-lu commented 11 months ago

Same error here. Seems that there is already a patch for Home Assistant: https://github.com/python-kasa/python-kasa/pull/477/files

hutny1980 commented 11 months ago

I'm having the same issue after a firmware upgrade

Altharion1 commented 11 months ago

Same issue here :( I had to put new plugs instead and carefully disable the auto update... Any chance to have an update ? Or does someone know another plugin that would work?

PeterC71 commented 11 months ago

Same issue here

rjtokenring commented 11 months ago

Yes, it is due to new auth handshake (KLAP). Here is what is in progress in kasa project.

https://github.com/python-kasa/python-kasa/pull/117/files#diff- f14950ebce450aed77d0c995da2f94b5ce78fb298cc27f1a72928ab6e25d0722

hutny1980 commented 11 months ago

Yes, it is due to new auth handshake (KLAP). Here is what is in progress in kasa project.

https://github.com/python-kasa/python-kasa/pull/117/files#diff- f14950ebce450aed77d0c995da2f94b5ce78fb298cc27f1a72928ab6e25d0722

@rjtokenring - forgive me - do you mean we should have a fix soon? I'm new to all this, so not clear on when (and if) we'll see a fix.

thanks, G

wcumps commented 11 months ago

Here the same issue....

guoper59 commented 10 months ago

Automatic update of firmware no more

guoper59 commented 10 months ago

there are any other alternative?

machasm1 commented 10 months ago

Is there a fix planned or has development ceased on this module?

Altharion1 commented 10 months ago

No answer since 2 months, no new version for more than a year, it seems that it's over :( I've not found any other way to make these plugs work with Node Red, did anyone do ?

guoper59 commented 10 months ago

if somebody has another option to automatise, even if it is not with node red, it is a pity

so-lu commented 10 months ago

Tried to downgrade to an old FW, but to no avail. But I did see that @sanlike0911 made a small commit 3 days ago, so this software is still maintained. Maybe @sanlike0911 can add the new encryption to a future version of node-red-contrib-tplink-tapo-connect-api (like was done in https://github.com/python-kasa/python-kasa/pull/477/files )

machasm1 commented 10 months ago

I found a work around by installing a python node function https://flows.nodered.org/node/node-red-contrib-python-function-ps and installing https://github.com/fishbigger/TapoP100 I was then able to call a python function to toggle the P100. A little convoluted but should get you out of a hole until this repo is updated.

unic8s commented 10 months ago

I found a work around by installing a python node function https://flows.nodered.org/node/node-red-contrib-python-function-ps and installing https://github.com/fishbigger/TapoP100 I was then able to call a python function to toggle the P100. A little convoluted but should get you out of a hole until this repo is updated.

Thanks for the great idea!

NOTE: I also had an issue like others https://github.com/fishbigger/TapoP100/issues/128 but there is a working fork https://github.com/almottier/TapoP100

guoper59 commented 10 months ago

It works perfectly, Thank you so much @machasm1

ac1176 commented 10 months ago

Hi @machasm1 - would you be able to elaborate exactly how you went about getting the python-function-ps node to trigger the necessary commands to toggle your P100 plug? I can connect and trigger my P100 plug using python3 in a terminal window, entering each command one by one, but I get an error in Node Red when I try running those same commands within the python-function-ps node ("...PyP100 Module Not Found Error: No module named PyP100"). I'm running Node Red within a Docker Container, which may complicate things.

ac1176 commented 10 months ago

Actually, never mind - I've just worked it out. I had to install Python3, Pip and the TapoP100 library within the Node Red container itself. All working again!

Philster72 commented 9 months ago

I now have this issue. Unfortunately, one of my P110 plugs had it's auto update set, so node-red flows that had been working perfectly for months suddenly stopped, and brought some major automations to a grinding halt. Node-red just reports {"result":false,"errorInf":"Error: Unexpected Error Code: 1003 (undefined)"}

Any news on a fix please?

Jhonyboy72 commented 9 months ago

Same here :-( Since a few days its no longer working. Code 1003

realhuno commented 9 months ago

Same here..... is there a workaround or something?

machasm1 commented 9 months ago

There is a workaround as outlined by me above. I will repeat it here for those that didnt see it above

I found a work around by installing a python node function https://flows.nodered.org/node/node-red-contrib-python-function-ps and installing https://github.com/fishbigger/TapoP100 I was then able to call a python function to toggle the P100. A little convoluted but should get you out of a hole until this repo is updated.

Altharion1 commented 9 months ago

Yes and it works great ! Thank you very much for that :)

crazy888 commented 9 months ago

P110 energy usage also not working with Python solution....

https://github.com/fishbigger/TapoP100/issues/134

paul-thomas1964 commented 9 months ago

I use this for energy monitoring and quite a nice nodered app, so would like to get it working again. I guess there’s no way to regress the firmware?

paul-thomas1964 commented 9 months ago

I’ve managed to work around this for myself. I also use hubitat HE. This has apps to interface to both nodeRed and TPlink TAPO. The HE tapo integration does work with the new firmware (and authentication method). The HE tapo app, creates HE devices mapped to the tapo devices. These devices can then be exposed to nodeRed and controlled or read from the nodeRed flows.

robmarcer commented 9 months ago

I installed a P110 yesterday, worked fine for the first few hours, I assume it then updated the firmware for the device, I now can't connect, I'm getting the following error.

{"result":false,"errorInf":"Error: Unexpected Error Code: 1003 (undefined)"}

I'm going to try the workaround suggested by @machasm1.

zoppolig commented 8 months ago

Hi, I did as suggested by @machasm1 . I had issues with installing from the fork https://github.com/almottier/TapoP100 I got this error:

sudo pip install git+https://github.com/almottier/TapoP100 error: externally-managed-environment

× This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.

I then installed it passing --break-system-packages, everything is fine and the installation works. In node-red, I used the python-function-ps node, with the following code (with the right IP, ID, and PW ;-):

user code here.

from PyP100 import PyP100

p100 = PyP100.P100("MYIP", "MYID", "MYPW") #Creates a P100 plug object

Turn on/off the plug based on input

def python_function(msg):

Check if the 'payload' key exists in the incoming message

if 'payload' in msg:
    # Example: Turn the plug on or off based on the payload
    if msg['payload'] == "ON":
        p100.turnOn()
    elif msg['payload'] == "OFF":
        p100.turnOff() 

# Return the original message or modify it as needed
return msg

The entry point for the function node

result = python_function(result)

I have an inject node with a msg.payload "ON" and one with msg.payload "OFF".

The debug node just says "ON" and "OFF", while the python-function-ps node has a green light, signaling "running" and "finished" when I inject a payload. That said, all is nice and dandy, but the plug still doesn't work.

Fimware version is 1.5.5

I believe there is an issue with that, but I do not have a clue how to solve it. Too bad, because I have like eight p100 plugs and now not even one works...

zoppolig commented 8 months ago

@machasm1 figured out how to solve everything, and it works like a charm! Basically, for those who do not know how to script in Python or just for the sake of simplicity, here's how to solve everything on a Raspberry Pi:

  1. pip3 install git+https://github.com/almottier/TapoP100.git@main --break-system-packages
  2. install the node-red-contrib-python-function-ps node
  3. point to the python PATH (in my case, global.python)
  4. Here's the code:

`from PyP100 import PyP100

ip = "MYIP" email = "MYEMAIL" password = "MYPWD"

plug = PyP100.P100(ip, email, password)

try: plug.handshake() plug.login() except Exception as e: return {"payload": {"error": str(e)}}

try: device_info = plug.getDeviceInfo() except Exception as e: device_info = {"error": f"Failed to get device info: {str(e)}"}

if msg["payload"] == "on": plug.turnOn() return {"payload": {"status": "Turned On", "deviceInfo": device_info}}

elif msg["payload"] == "off": plug.turnOff() return {"payload": {"status": "Turned Off", "deviceInfo": device_info}}

else: return {"payload": {"error": "Invalid command", "deviceInfo": device_info}} `

Now that works like a charm, and I'm using the latest firmware update for the Tapo p100 plugs, 'fw_ver': '1.5.5 Build 20230927 Rel. 40646', 'hw_ver': '1.20.0'

joside commented 7 months ago

switched to this fork now and it works again!

https://github.com/mbserran/node-red-contrib-tapo-new-api

Staubgeborener commented 7 months ago

switched to this fork now and it works again!

https://github.com/mbserran/node-red-contrib-tapo-new-api

i can confirm this