tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
874 stars 206 forks source link

Tuya broken after updating to HA Core 2021.12.10 #768

Open bkr1969 opened 2 years ago

bkr1969 commented 2 years ago

Describe the bug Devices function properly in Tuya app but don't update in HA

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Home Assistant Version

Device info (please complete the following information, which can be found in log): like this: { "active_time": 1623229189, "biz_type": 18, "category": "cz", "create_time": 1560491945, "icon": "smart/product_icon/cz.png", "id": "aaaaaaaaaaa", "ip": "xxxxxxxxxxxxxxxx", "lat": "xxxxxxxxxx", "local_key": "xxxxxxxxxxxxx", "lon": "xxxxxxx", "model": "", "name": "Living Room Socket", "online": false, "owner_id": "34794909", "product_id": "yfemiswbgjhddhcf", "product_name": "Switch Product", "status": [ { "code": "switch", "value": false }, { "code": "countdown_1", "value": 0 }, { "code": "cur_current", "value": 0 }, { "code": "cur_power", "value": 0 }, { "code": "cur_voltage", "value": 2343 } ], "sub": false, "time_zone": "+08:00", "uid": "xxxxxxxxxxxxxxxxxxx", "update_time": 1625101929, "uuid": "xxxxxxxxxxxxxxxxxx" }

Device specifications (please complete the following information, which can be found in log): Same device's id, like this: [2021-07-01 10:18:01,351] [tuya-openapi] Request: method = GET, url = https://openapi.tuyacn.com/v1.0/devices/aaaaaaaaaaa/specifications, params = None, body = None, headers = {'client_id': 'xxxxxxxxxxxx', 'sign': 'xxxxxxxxxxxx', 'sign_method': 'HMAC-SHA256', 'access_token': 'xxxxxxxxxxxxxxxx', 't': '1625105881351', 'lang': 'en'} 2021-07-01 10:18:01 DEBUG (SyncWorker_1) [tuya iot] Response: { "result": { "category": "cz", "functions": [ { "code": "countdown_1", "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" }, { "code": "switch", "type": "Boolean", "values": "{}" } ], "status": [ { "code": "cur_voltage", "type": "Integer", "values": "{\"unit\":\"V\",\"min\":0,\"max\":2500,\"scale\":0,\"step\":1}" }, { "code": "cur_current", "type": "Integer", "values": "{\"unit\":\"mA\",\"min\":0,\"max\":30000,\"scale\":0,\"step\":1}" }, { "code": "switch", "type": "Boolean", "values": "{}" }, { "code": "cur_power", "type": "Integer", "values": "{\"unit\":\"W\",\"min\":0,\"max\":50000,\"scale\":0,\"step\":1}" }, { "code": "countdown_1", "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" } ] }, "success": true, "t": 1625105881348 }

Additional context [2022-01-19 21:02:02,212] [tuya-openmq] Unexpected disconnection.7 2022-01-19 21:02:02 ERROR (Thread-175) [tuya_iot] Unexpected disconnection.7 [2022-01-19 21:02:03,353] [tuya-openmq] Unexpected disconnection.7 2022-01-19 21:02:03 ERROR (Thread-196) [tuya_iot] Unexpected disconnection.7 [2022-01-19 21:02:04,482] [tuya-openmq] Unexpected disconnection.7 2022-01-19 21:02:04 ERROR (Thread-175) [tuya_iot] Unexpected disconnection.7 [2022-01-19 21:02:05,620] [tuya-openmq] Unexpected disconnection.7 2022-01-19 21:02:05 ERROR (Thread-196) [tuya_iot] Unexpected disconnection.7 [2022-01-19 21:02:06,752] [tuya-openmq] Unexpected disconnection.7 2022-01-19 21:02:06 ERROR (Thread-175) [tuya_iot] Unexpected disconnection.7 [2022-01-19 21:02:07,884] [tuya-openmq] Unexpected disconnection.7 2022-01-19 21:02:07 ERROR (Thread-196) [tuya_iot] Unexpected disconnection.7 [2022-01-19 21:02:09,018] [tuya-openmq] Unexpected disconnection.7 2022-01-19 21:02:09 ERROR (Thread-175) [tuya_iot] Unexpected disconnection.7 [2022-01-19 21:02:10,161] [tuya-openmq] Unexpected disconnection.7

bkr1969 commented 2 years ago

This is apparently an issue with the state displaying correctly. If the entity is reloaded manually the state will update, otherwise not.

JensHKnudsen commented 2 years ago

I'm having the same issue.

Home Assistant Version billede

Newly created Tuya account + project and linked app Device values only updates for my devices when Tuya integration is manually reloaded in Home Assistant I can control the devices but I'm just not getting the current values from the devices

Can get values with the Tuya API Explorer

billede

billede

Getting no errors in my homeassistant.log (yes... I did add configuration to my configuration.yaml and restarted HomeAssistant)

bkr1969 commented 2 years ago

I managed a work-around using input_booleans and triggering the associated tuya switch with them in node red which also then reloads the tuya integration. If I tried just reloading the integration on the state change of the tuya switches it got caught up in an infinite loop.

hobojoe commented 2 years ago

Same here :(

Utopia69 commented 2 years ago

Same problem, sensors are not updated they only update after reload ...

Gferretta commented 2 years ago

Hi This error continues on HA 2022.3.3 Integration's Refresh is a "partial solution" Any news for solution? Thanks

paolopascali commented 2 years ago

Same here