apatsufas / homebridge-tapo-p100

Homebridge TP-LINK Tapo P100 Platform Plugin
Apache License 2.0
64 stars 14 forks source link

P100: Not able to control plug after disconnect/connect from wall #4

Closed PCasp closed 3 years ago

PCasp commented 3 years ago

After disconnecting and then reconnecting the plug tapo P100 to the wall, we are not able to control it from Homekit anymore. The plug still appears in Homekit with online status but it doesn't respond when we try to turn it on for example.

apatsufas commented 3 years ago

Could you sent me your Homebridge log?

PCasp commented 3 years ago

@apatsufas sorry for the delay in my answer. After unplugging and then plugging it to the wall, when trying to control it from the home app, i get this in the log:

[12/03/2021, 14:20:12] [Tapo Smart Platform] 348 Error Code: 9999, undefined [12/03/2021, 14:20:12] [homebridge-tapo] This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. See https://git.io/JtMGR for more info. [12/03/2021, 14:20:14] [Tapo Smart Platform] 348 Error Code: 9999, undefined [12/03/2021, 14:20:14] [homebridge-tapo] This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. See https://git.io/JtMGR for more info. [12/03/2021, 14:20:14] [Tapo Smart Platform] 284 Error Code: 9999, undefined [12/03/2021, 14:20:18] [Tapo Smart Platform] 348 Error Code: 9999, undefined [12/03/2021, 14:20:18] [homebridge-tapo] This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. See https://git.io/JtMGR for more info. [12/03/2021, 14:20:18] [Tapo Smart Platform] 284 Error Code: 9999, undefined

PCasp commented 3 years ago

@apatsufas also let me add that after this, if I restart homebridge with the plug connected to the wall, then the error disapears and i'm able to control it from Homekit again.

apatsufas commented 3 years ago

@PCasp good to see it working again. Yeah I had the same issue after an power outage. I'm not really sure what happens but restarting homebridge and/or unplugging the outlet fixes the issue

gingemonster commented 3 years ago

Looking a little into this (it also does it with the L510 bulb) Im guessing its because if you power down the device and then power it up again the token used to call its web service will have changed but the code still has even handlers setup with the old token? Perhaps when receiving this error the code could try and reset and register the device? I tried to follow the code to see how this might be done but couldn't easily follow it enough to understand how that might work

apatsufas commented 3 years ago

@gingemonster That sounds possible. I'll have a look at it when I have some free time. Thanks.

apatsufas commented 3 years ago

If implemented a reconnection attempt when receiving an 9999 error in release 1.4.6.