Closed bc2297 closed 3 years ago
Thank you for the extensive bug report. This is really helpful in getting some insights.
Has this happened to you once? Or is this more of a recurring thing?
Hi @milo526 sorry for the delayed response. It's a recurring issue. I just noticed today I ran into it again for the first time since I filed the bug, which is a 10 day separation between drops. There's nothing critical that requires this to work for me, so I can leave it in the hung state if you have any debugging ideas I can try before restarting. And if you'd like me to run some debugging code to figure it out next time it hangs, I can do that too. Appreciate the help!
I have a very similar problem. My problem is repetitive and happens every 10 days. Previously I used to get a SIGTERM error every 10 days and needed to reboot but with this app I get a NO VALID TOKEN error and restarting the service seems to work, however it would be nice to sort it out.
23:11:20 Hoobs No Valid Token.txt
The config is:
{ "server": { "port": 80, "origin": "*", "autostart": 0, "home_setup_id": “redacted”, "polling_seconds": 5 }, "client": { "default_route": "status", "inactive_logoff": 30, "theme": "hoobs-light", "locale": "en", "temp_units": "celsius", "country_code": "GB", "postal_code": “redacted”, "latitude": “redacted”, "longitude": “redacted” }, "bridge": { "name": "HOOBS", "port": 51826, "pin": "redacted", "username": "redacted" }, "description": "", "ports": {}, "accessories": [], "platforms": [ { "platform": "TuyaWebPlatform", "name": "TuyaWebPlatform", "options": { "username": “redacted”, "password": “redacted”, "countryCode": xx, "platform": "smart_life" }, "plugin_map": { "plugin_name": "homebridge-tuya-web" }, "scenes": false, "defaults": [], "scenesWhitelist": [], "hiddenAccessories": [] }, { "platform": "Ring", "plugin_map": { "plugin_name": "homebridge-ring" }, "refreshToken": "redacted" } ] }
Sorry I'm new to all this Plug-In version is 0.4.8
I've experienced the exact same issue. If you need some more info or logs, please let me know. Plugin version 0.4.8
Are y'all using hoobs?
I’m using homebridge + Homebridge Config UI X
Are y'all using hoobs?
I am
yes. I'm on HOOBS 3.2.10 the current version.
Upgraded to Hoobs 3.3.1 yesterday (1/12/20) so will see what happens in 10 days time.
Got the same problem again. About 10 days after the previous time.
I found the issue 🎉
I'm fixing this along with some other issues, just working on the last few bugs. Expect a beta release to land somewhere this week.
Wow great! Care to explain, in high level, what the problem was? Just curious.
Tuya uses so called "access tokens". I use your username and password to request one of these access tokens from the tuya server. Whenever I want to do something with your devices, I need to send the access token along to ensure tuya that the request is coming from the owner of the device.
These access-tokens are valid for.... you guessed it... 10 days.
Previous versions of this library used to request a new token after just under 10 days to ensure that you always have a fresh token. Somewhere in a code change; that code that refreshes the token got removed by me (don't ask me why 😛, I don't know) and thus your token won't be valid after 10 days and you get the error.
I once again added some code that refreshes your token after 9 days and 23 hours to ensure that you once more always have a fresh token.
Excellent news. And thankfully a fairly simple solution.
@milo526 Will you be pushing a new release out?
I'm hitting this and have the latest version 0.4.8
installed according to Homebridge and here. Looks like you have later builds, but they aren't tagged correctly so users of Homebridge haven't been getting your updates since Sept.
I've noticed in the homebridge UI you can select the newer version, although it defaults to the latest "release" tag
Thank you for your concern,
I am aware that these releases were not tagged "latest". Mostly because they are either completely untested or are known to contain severe bugs.
These tags (i.e. the heater-cooler tag) are meant to enable others to easily test new releases.
I know I haven't pushed a new public release since September. As you figured out I definitely did do work on the plugin but sometimes personal life gets in the way of opensource work 😛
And this is now released in pre-release version 0.5.4.
If you want to; you can update to this pre-release.
Please let me know if you have any issues!
Sorry to be a pain. How do I update to the pre-release? I am using HOOBS.
Thanks for any help or direction.
Mike
cd ~/.hoobs/
npm install @milo526/homebridge-tuya-web@0.5.4
Thanks very much.
Mike
Hoorah! Broken the 10 day barrier…. Thanks Milo.
Describe the bug After weeks of consistent uptime, I will be unable to control my devices until I restart hoobs. In the log, I see this error: 11/11/2020, 4:26:02 PM [TuyaWebPlatform] [Bistro Lights] - Unsetting debouncedDeviceStateRequestPromise 11/11/2020, 4:26:02 PM [TuyaWebPlatform] [Bistro Lights] - [GET] No valid token 11/11/2020, 4:26:02 PM [TuyaWebPlatform] [House Christmas Lights] - Unsetting debouncedDeviceStateRequestPromise 11/11/2020, 4:26:02 PM [TuyaWebPlatform] [House Christmas Lights] - [GET] No valid token
And after restarting I get normal operation and see
11/11/2020, 4:26:03 PM [TuyaWebPlatform] [Bistro Lights] - Requesting device state 11/11/2020, 4:26:03 PM [TuyaWebPlatform] [Bistro Lights] - Creating new debounced promise 11/11/2020, 4:26:03 PM [TuyaWebPlatform] [Bistro Lights] - Triggering debouncedDeviceStateRequest
Steps To Reproduce Obviously difficult to reproduce given the long uptime. I'm happy to throw in some debug statements or something and update when it happens again
Plugin Version 0.4.8
Homebridge Config
Device Config
Getting credentials Got credentials { 'access_token': 'AZhaz1575155944565PvF8vZqSW8yaPyt', 'expires_in': 864000, 'refresh_token': 'AZhaz1575155944565PvF8vWxktsTlBjR', 'token_type': 'bearer'} Getting devices Got devices { 'header': {'code': 'SUCCESS', 'payloadVersion': 1}, 'payload': { 'devices': [ { 'data': {'online': False, 'state': False}, 'dev_type': 'switch', 'ha_type': 'switch', 'icon': 'https://images.tuyaus.com/smart/icon/1511839633_0.png', 'id': '37677666600194d244ec_1', 'name': 'Front Yard Christmas Tree'}, { 'data': {'online': False, 'state': False}, 'dev_type': 'switch', 'ha_type': 'switch', 'icon': 'https://images.tuyaus.com/smart/icon/1511839633_0.png', 'id': '37677666600194d244ec_2', 'name': 'Switch 2'}, { 'data': {'online': False, 'state': False}, 'dev_type': 'switch', 'ha_type': 'switch', 'icon': 'https://images.tuyaus.com/smart/icon/1511839633_0.png', 'id': '37677666600194d24305_1', 'name': 'Garage Christmas Lights'}, { 'data': {'online': False, 'state': False}, 'dev_type': 'switch', 'ha_type': 'switch', 'icon': 'https://images.tuyaus.com/smart/icon/1511839633_0.png', 'id': '37677666600194d24305_2', 'name': 'Switch 2'}, { 'data': {'online': False, 'state': False}, 'dev_type': 'switch', 'ha_type': 'switch', 'icon': 'https://images.tuyaus.com/smart/icon/1511839633_0.png', 'id': '37677666600194d242d7_1', 'name': 'Trellis Christmas Lights'}, { 'data': {'online': False, 'state': False}, 'dev_type': 'switch', 'ha_type': 'switch', 'icon': 'https://images.tuyaus.com/smart/icon/1511839633_0.png', 'id': '37677666600194d242d7_2', 'name': 'Switch 2'}, { 'data': {'online': True, 'state': True}, 'dev_type': 'switch', 'ha_type': 'switch', 'icon': 'https://images.tuyaus.com/smart/icon/1511839633_0.png', 'id': '37677666600194d23963_1', 'name': 'House Christmas Lights'}, { 'data': {'online': True, 'state': False}, 'dev_type': 'switch', 'ha_type': 'switch', 'icon': 'https://images.tuyaus.com/smart/icon/1511839633_0.png', 'id': '37677666600194d23963_2', 'name': 'Bistro Lights'}], 'scenes': []}}
Additional Context
Happy to help debug on this