RaresAil / homebridge-tp-link-tapo

A platform to implement the tp-link tapo device and Adaptive Lighting for light bulbs
https://www.npmjs.com/package/homebridge-tp-link-tapo
Apache License 2.0
64 stars 5 forks source link

Session expired #47

Open Zefuna opened 1 year ago

Zefuna commented 1 year ago

Describe The Bug

Some hours after the first setup all 5 Tapo devices get a timeout (expired session). They got permanent ips. The only way to fix this, is to re-setup the devices in the Tapo app. Restarting the (child) bridge or reinstalling the plugin doesn’t help.

Expected behavior

No expired sessions or starting new session

Logs

[16/07/2023, 08:58:111 [Tapo] Session expired [16/07/2023,08:58:11] [Tapo] Trying to login again. [16/07/2023,08:58:11] [Tapo] Session expired [16/07/2023,08:58:11] [Tapo Trying to login again. [16/07/2023,08:58:11] [Tapo] Command error: deviceInfo > -1501 [16/07/2023,08:58:11] [Tapo] Failed to get info about: xxx.xxx.x.xxx [16/07/2023,08:58:11] [Tapo] Retry to connect in 10s: xxx.xxx.x.xxx [16/07/2023,08:58:11] [Tapo] Command error: deviceInfo > -1501 [16/07/2023,08:58:11] [Tapo] Failed to get info about: xxx.xxx.x.xxx [16/07/2023,08:58:11] [Tapo] Retry to connect in 10s: xxx.xxx.x.xxx [16/07/2023,08:58:11] [Tapo] Command error: deviceInfo > 9999 [16/07/2023,08:58:11] [Tapo] Failed to get info about: xxx.xxx.x.xxx [16/07/2023,08:58:11] [Tapo] Retry to connect in 10s : xxx.xxx.x.xxx

Plugin Config

{ "_bridge" : { "port" : xxxxx, "username" : "xx:xx:xx:xx:xx:xx" }, "addresses" : [ "xxx.xxx.x.xxx", "xxx.xxx.x.xxx", "xxx.xxx.x.xxx", "xxx.xxx.x.xxx", "xxx.xxx.x.xxx" ], "email" : "xxxx@xxxx.xx“, "name" : "Tapo", "password" : "xxxxxxxxxxxxxx", "platform" : "HomebridgeTPLinkTapo" }

Plugin Version

3.2.2

Homebridge Version

1.6.1

Node.js Version

N/A

NPM Version

9.5.1

Operating System

Raspberry Pi 4

cheetah3k5 commented 1 year ago

I have the same problem starting earlier this day

R-STR commented 1 year ago

Same problem here, started yesterday

[7/17/2023, 6:38:19 PM] [Tapo] Session expired [7/17/2023, 6:38:19 PM] [Tapo] Trying to login again. [7/17/2023, 6:38:19 PM] [Tapo] Command error: deviceInfo > 9999 [7/17/2023, 6:38:19 PM] [Tapo] Failed to get info about: xx.xx.xx.xx [7/17/2023, 6:38:19 PM] [Tapo] Retry timeout: xx.xx.xx.xx

Georgesab commented 1 year ago

Also getting this for the last 3 days. Tried power cycling everything as well as removing and re-adding the plug-in

RaresAil commented 1 year ago

I will be checking starting 7 August

KayleeWilliams commented 1 year ago

Also getting this issue.

Bouboudu49 commented 1 year ago

Me too… I can't find a solution at the moment. The problem seems to come from TP Link which does not authorize the session

cheetah3k5 commented 1 year ago

I have tried changing my password to one under 8 characters (i have read that that might be a problem), no luck The only thing that works (for a few hours) is deleting the plugs from the Tapo App, deleting the Homebridge plugin, adding the plugs back in the Tapo app, and then reinstalling the Homebridge Plugin

thespurofthings commented 1 year ago

I have the same issues now and even a clean install and clearing caches doesn't seem to fix it.

cheetah3k5 commented 1 year ago

Any updates on this issue? Because this turned very quickly from the most stable plugin in my homebridge to literally unusable :)

RaresAil commented 1 year ago

Can you provide the firmware version of the lights?

cheetah3k5 commented 1 year ago

Mine are all at 1.4.18 Build 20230711 Rel. 55651 (all are P100)

KayleeWilliams commented 1 year ago

Can you provide the firmware version of the lights?

My two P100's are on 1.4.18 Build 20230711 Rel 55651.

mrsilver76 commented 1 year ago

Can you provide the firmware version of the lights?

I'm using the UK version of the P100 and all four of them are reporting firmware versions of 1.1.5 Build 230324 Rel. 143956

(there is no firmware update available)

RaresAil commented 1 year ago

Did the issue started with the latest firmware update?

cheetah3k5 commented 1 year ago

In my case, no. It started before, and I have updated them at the latest firmware after deleting them and re-adding them in the Tapo app in an attempt to fix the issue.

Zefuna commented 1 year ago

@RaresAil L900: 1.0.16 Build 220902 Rel.151030 P100: 1.4.18 Build 20230711 Rel. 55651

When I created this issue I’ve installed the plugin for the first time, can’t confirm or deny if the problem startet with the latest update

RaresAil commented 1 year ago

What nodejs version do you have?, is specified in homebridge dashboard. P.S. i released version 3.3.0 which add supports for the H100 and S200

cheetah3k5 commented 1 year ago

What nodejs version do you have?, is specified in homebridge dashboard. P.S. i released version 3.3.0 which add supports for the H100 and S200

Mine sais v18.17.1. I have tired updating to 3.3.0 however I get this error: npm ERR! code ENOTEMPTY npm ERR! syscall rename npm ERR! path /homebridge/node_modules/homebridge-tp-link-tapo npm ERR! dest /homebridge/node_modules/.homebridge-tp-link-tapo-QwatkUZi npm ERR! errno -39 npm ERR! ENOTEMPTY: directory not empty, rename '/homebridge/node_modules/homebridge-tp-link-tapo' -> '/homebridge/node_modules/.homebridge-tp-link-tapo-QwatkUZi'

Edit: I have deleted the plugin directory and reinstalled the plugin but get the same (and no accesorry found anymore, they were probably restored from cache before) [8/31/2023, 6:58:40 PM] [TPLink Tapo Platform] Command error: deviceInfo > -1501 [8/31/2023, 6:58:40 PM] [TPLink Tapo Platform] Failed to get info about: x.x.x.x

Edit2: I have deleted all the plugs in the tapo app and readded them and can confirm that they appear in homebridge now. I will come back when (if) "Command error: deviceInfo > -1501" starts showing up again

Edit3: it went back to the error. it just took longer than before

KayleeWilliams commented 1 year ago

What nodejs version do you have?, is specified in homebridge dashboard. P.S. i released version 3.3.0 which add supports for the H100 and S200

I'm using v18.17.1

Zefuna commented 1 year ago

I‘m running on node.js v18.16.0

RaresAil commented 1 year ago

Try the latest version and see if it is working v3.3.0

RaresAil commented 1 year ago

That error can also mean an invalid password, did the password got changed?

KayleeWilliams commented 1 year ago

Try the latest version and see if it is working v3.3.0

No updating to v3.3.0 hasn't helped.

[31/08/2023, 19:06:38] Command error: deviceInfo > -1501 Failed to get info about: xxx.xxx.x.xxx [31/08/2023, 19:05:15] Retry to connect in 10s : xxx.xxx.x.xxx

My password hasn't changed but maybe resetting it could fix, will give it a try and edit if it works.

edit: Resetting hasn't helped.

cheetah3k5 commented 1 year ago

That error can also mean an invalid password, did the password got changed?

I have changed my password a few weeks ago to one under 8 characters because I have read that it might be an issue, but that didn't solve the problem. The password itself it's not the problem in this case because after the up mentioned repairing each plug in the tapo app I can get the plugin to see each plug and works for a while (a few hours, a day at most) but after it goes to the same error

mrsilver76 commented 1 year ago

Try the latest version and see if it is working v3.3.0

No updating to v3.3.0 hasn't helped.

[31/08/2023, 19:06:38] Command error: deviceInfo > -1501 Failed to get info about: xxx.xxx.x.xxx [31/08/2023, 19:05:15] Retry to connect in 10s : xxx.xxx.x.xxx

Can confirm that updating to 3.3.0 hasn’t helped me either, exactly the same errors as above.

RaresAil commented 1 year ago

If you reduce the number of devices, will it work? try this:

  1. Remove all ips and restart the child bridge
  2. Add 1 by 1 and restart the bridge after each add and see if it is working
cheetah3k5 commented 1 year ago

If you reduce the number of devices, will it work? try this:

  1. Remove all ips and restart the child bridge
  2. Add 1 by 1 and restart the bridge after each add and see if it is working

Will try it. For now...to my surprise, the plugin is up and running as it should since yesterday without any issues. Will wait to see if/when it goes haywire again, and if so, will try the up mentioned

Edit: it stopped working and tried adding only one plug. still the same result after a while

Zefuna commented 1 year ago

If you reduce the number of devices, will it work? try this:

  1. Remove all ips and restart the child bridge
  2. Add 1 by 1 and restart the bridge after each add and see if it is working

I‘ve updated the plugin and the node.js, followed this steps afterwards - but I get the same timeouts as before

RaresAil commented 1 year ago

Can you guys go in homebridge terminal, write node and than Date.now()? and to exit write .exit

homebridge@server:/var/lib/homebridge $ node
Welcome to Node.js v18.16.0.
Type ".help" for more information.
> Date.now()
1693813816606
> .exit
homebridge@server:/var/lib/homebridge $ 
cheetah3k5 commented 1 year ago

root@homebridge:/var/lib/homebridge $ node Welcome to Node.js v18.17.1. Type ".help" for more information.

Date.now() 1693814170657 .exit root@homebridge:/var/lib/homebridge $

KayleeWilliams commented 1 year ago

Can you guys go in homebridge terminal, write node and than Date.now()? and to exit write .exit

homebridge@server:/var/lib/homebridge $ node
Welcome to Node.js v18.16.0.
Type ".help" for more information.
> Date.now()
1693813816606
> .exit
homebridge@server:/var/lib/homebridge $ 

Welcome to Node.js v18.17.1. Type ".help" for more information.

Date.now() 1693814160430 .exit

RaresAil commented 1 year ago

The value seems fine, can yo try a full reset to the device? I searched and these steps helped few people, these steps are for the plug, not sure for L900 if is the same

Remove device from app (light flashes red / green)
Hold the power button down for 10-15 seconds
Light goes green
Relay clicks once
Light starts flashing red / green
Add back to the app

Or these ones:

Remove plug from switch (got caught and had to power down a box)
Remove switch from app
Relay clicks to the ON setting
Add switch back into the device
cheetah3k5 commented 1 year ago

The value seems fine, can yo try a full reset to the device? I searched and these steps helped few people, these steps are for the plug, not sure for L900 if is the same

Remove device from app (light flashes red / green)
Hold the power button down for 10-15 seconds
Light goes green
Relay clicks once
Light starts flashing red / green
Add back to the app

Or these ones:

Remove plug from switch (got caught and had to power down a box)
Remove switch from app
Relay clicks to the ON setting
Add switch back into the device

Already did that. This is the only thing that makes the accesories work for a while. I don't even have to reinstall the plugin in homebridge. However, it only keeps working for a few hours, up to a day maximum (in my case)

Zefuna commented 1 year ago

Already did that. This is the only thing that makes the accesories work for a while. I don't even have to reinstall the plugin in homebridge. However, it only keeps working for a few hours, up to a day maximum (in my case)

I can confirm this - resetting tapo devices itself works for some hours before getting the same timeout again

RaresAil commented 1 year ago

Sadly i have no idea how i can help further 😞 , i could try to add as a fallback to use the cloud api, but a downsize of that is if you have no internet connection, you won't able to control the device and requests might take longer

cheetah3k5 commented 1 year ago

Sadly i have no idea how i can help further 😞 , i could try to add as a fallback to use the cloud api, but a downsize of that is if you have no internet connection, you won't able to control the device and requests might take longer

From my point of view...I would try it, because in this state it's useless, I have reverted using the Tapo shortcuts (that are slower than the plugin when it works, in the first place). Regarding the internet connection ... i don't really have a problem with that, i have homebridge as a docker on a nas with dual wan and internet redundancy, so if that's what it takes to make it work...

RaresAil commented 1 year ago

Hey, can you guys try version 4.0.0? maybe it fixes the issue

EDIT: Version 4 adds support for KLAP which is a new protocol for some devices

RaresAil commented 1 year ago

Also, do your devices got any software updates from tapo app? If your device gets updated to KLAP protocol that is now supported in v4, is more stable and could fix this issue

Zefuna commented 12 months ago

Updating the plugin and the devices didn’t help. I also reseted all devices in the Tapo app just to be sure - for now (about 1,5 days) everything is running. I’ll give an update in a view days if everything is fine now 🙏🏻

mrsilver76 commented 12 months ago

I no longer get "session expired" messages, but it doesn't appear to be able to connect to my plug:

[15/09/2023, 14:48:23] [TPLink Tapo] Failed to get info about: 192.168.0.13
[15/09/2023, 14:48:23] [TPLink Tapo] Retry to connect in 10s : 192.168.0.13
[15/09/2023, 14:48:33] [TPLink Tapo] Try for 192.168.0.13 : 19/20
[15/09/2023, 14:48:35] [TPLink Tapo] Failed to get info about: 192.168.0.13
[15/09/2023, 14:48:35] [TPLink Tapo] Retry to connect in 10s : 192.168.0.13
[15/09/2023, 14:48:45] [TPLink Tapo] Try for 192.168.0.13 : 18/20
[15/09/2023, 14:48:47] [TPLink Tapo] Failed to get info about: 192.168.0.13
[15/09/2023, 14:48:47] [TPLink Tapo] Retry to connect in 10s : 192.168.0.13

I'm able to ping the plug, turn it on and off in the Tapo app and visiting http://192.168.0.13 reports "200 OK".

I will keep playing.

RaresAil commented 12 months ago

@mrsilver76 what plug? Do you have any update available for that? And try to restart the child bridge

mrsilver76 commented 12 months ago

@RaresAil Tapo P100 (UK version) running 1.1.5 Build 230324 Rel. 143956. There are no software updates available.

I've restarted the child bridge and that didn't work. I then removed everything and re-added only the one IP address and then re-did the child bridge. I get:

[15/09/2023, 18:56:10] Homebridge v1.6.1 (HAP v0.11.1) (Homebridge AEAC) is running on port 51108.
[15/09/2023, 18:56:27] [TPLink Tapo Platform] Launched child bridge with PID 3558
[15/09/2023, 18:56:29] Registering platform 'homebridge-tp-link-tapo.HomebridgeTPLinkTapo'
[15/09/2023, 18:56:29] [TPLink Tapo Platform] Loaded homebridge-tp-link-tapo v4.0.0 child bridge successfully
[15/09/2023, 18:56:32] Homebridge v1.6.1 (HAP v0.11.1) (TPLink Tapo Platform) is running on port 36991.
[15/09/2023, 18:56:40] [TPLink Tapo Platform] Failed to get info about: 192.168.0.13
[15/09/2023, 18:56:40] [TPLink Tapo Platform] Retry to connect in 10s : 192.168.0.13

Homebridge version is 1.6.1, Node JS version is 18.17.1

KayleeWilliams commented 12 months ago

Hey, can you guys try version 4.0.0? maybe it fixes the issue

EDIT: Version 4 adds support for KLAP which is a new protocol for some devices

Still getting the error with my P100 plugs,

Try for 192.168.1.104 : 8/20 Failed to get info about: 192.168.1.104 Retry to connect in 10s : 192.168.1.104

However I am now getting this error on my L530 Lightbulb

Error sending command: deviceInfo Error: Failed to verify server hash at KlapAPI.firstHandshake (/var/lib/homebridge/node_modules/homebridge-tp-link-tapo/src/api/KlapAPI.ts:196:11) at processTicksAndRejections (node:internal/process/task_queues:95:5) at /var/lib/homebridge/node_modules/homebridge-tp-link-tapo/src/api/KlapAPI.ts:109:51 Failed to get info about: 192.168.1.108 Retry to connect in 10s : 192.168.1.108

Zefuna commented 11 months ago

Updating the plugin and the devices didn’t help. I also reseted all devices in the Tapo app just to be sure - for now (about 1,5 days) everything is running. I’ll give an update in a view days if everything is fine now 🙏🏻

Still running, seems to be fixed for me. Thank you!

RaresAil commented 11 months ago

Updating the plugin and the devices didn’t help. I also reseted all devices in the Tapo app just to be sure - for now (about 1,5 days) everything is running. I’ll give an update in a view days if everything is fine now 🙏🏻

Still running, seems to be fixed for me. Thank you!

Great, was there any firmware update on the device?

RaresAil commented 11 months ago

Hey, can you guys try version 4.0.0? maybe it fixes the issue

EDIT: Version 4 adds support for KLAP which is a new protocol for some devices

Still getting the error with my P100 plugs,

Try for 192.168.1.104 : 8/20

Failed to get info about: 192.168.1.104

Retry to connect in 10s : 192.168.1.104

However I am now getting this error on my L530 Lightbulb

Error sending command: deviceInfo Error: Failed to verify server hash

at KlapAPI.firstHandshake (/var/lib/homebridge/node_modules/homebridge-tp-link-tapo/src/api/KlapAPI.ts:196:11)

at processTicksAndRejections (node:internal/process/task_queues:95:5)

at /var/lib/homebridge/node_modules/homebridge-tp-link-tapo/src/api/KlapAPI.ts:109:51

Failed to get info about: 192.168.1.108

Retry to connect in 10s : 192.168.1.108

Restart the bridge/lights

RaresAil commented 11 months ago

@RaresAil Tapo P100 (UK version) running 1.1.5 Build 230324 Rel. 143956. There are no software updates available.

I've restarted the child bridge and that didn't work. I then removed everything and re-added only the one IP address and then re-did the child bridge. I get:


[15/09/2023, 18:56:10] Homebridge v1.6.1 (HAP v0.11.1) (Homebridge AEAC) is running on port 51108.

[15/09/2023, 18:56:27] [TPLink Tapo Platform] Launched child bridge with PID 3558

[15/09/2023, 18:56:29] Registering platform 'homebridge-tp-link-tapo.HomebridgeTPLinkTapo'

[15/09/2023, 18:56:29] [TPLink Tapo Platform] Loaded homebridge-tp-link-tapo v4.0.0 child bridge successfully

[15/09/2023, 18:56:32] Homebridge v1.6.1 (HAP v0.11.1) (TPLink Tapo Platform) is running on port 36991.

[15/09/2023, 18:56:40] [TPLink Tapo Platform] Failed to get info about: 192.168.0.13

[15/09/2023, 18:56:40] [TPLink Tapo Platform] Retry to connect in 10s : 192.168.0.13

Homebridge version is 1.6.1, Node JS version is 18.17.1

Does it work now?

Zefuna commented 11 months ago

Great, was there any firmware update on the device?

Nope, the devices are still running on the same firmware versions like 3 weeks ago (as commented). The latest plugin update + deleting and setting up all devices in the Tapo app fixed it in my case

mrsilver76 commented 11 months ago

Does it work now?

Not for me, sorry.

There is no update to the plugin (running 4.0.0) and no firmware update for the Tapo P100 plugs (running 1.1.5 Build 230324 Rel. 143956) either.

I've removed everything again and added a single (new) plug and it's still spitting out the same "failed to get info about" error message. I can control that plug with the Tapo app just fine and visiting the IP address of the plug in a browser returns "200 OK".

Is there any way I can turn on some kind of verbose logging that will help?

mrsilver76 commented 11 months ago

Hi, there doesn't appear to be any updates (either to homebridge, the plugin or the P100 firmware) so everything is still in the same unworkable state.

Any suggestions on what I can do? Thanks.