Closed Fertx0 closed 3 weeks ago
See discussion #522 for how to resolve your connection issues. Likely the issue is that your app is still running after scanning the QR code, and is blocking the local connection to the device. You need to force close the app, or turn off WiFi on your device.
After digging for hours in the tuya-local and tinytuya code and trying a thousand things, I found that the problem was a misunderstanding of what Device Id and Sub Device Id means for a Tuya element connecting though a WiFi gateway.
In my case:
Device ID is the "id" of the device: from the devices.json:
"id": "bfa64369996a901e49tvfn",
The IP address is the IP address of the WiFi gateway
Local Key is the same for both, at least in my case
Sub Device Id (for devices connected via gateway) is the "node_id" for the device in devices.json
"node_id": "AB1",
Just in case someone finds the same problem, it took me way too long to sort it out, basically because I didn't read the documentation https://github.com/make-all/tuya-local?tab=readme-ov-file#connecting-to-devices-via-hubs
And thanks a lot for your great work with this code!
Description
When I try to add the Garza ITV103W device, HomeAssistant comes back with the message: "Unable to connect to your device with those details. It could be an intermittent issue, or they may be incorrect."
The log message reports:
2024-10-30 13:03:07.850 ERROR (MainThread) [custom_components.tuya_local.device] Failed to refresh device state for Test. 2024-10-30 13:04:39.079 WARNING (SyncWorker_4) [custom_components.tuya_local.device] Test protocol error 914: Check device key or version 2024-10-30 13:07:00.809 ERROR (MainThread) [custom_components.tuya_local.device] Failed to refresh device state for Test.
Steps to reproduce
Expected behaviour
No response
Additional context
` homeassistant:/config# cat devices.json [ { "name": "Programador de Riego Wifi Garza", "id": "bfa64369996a901e49tvfn", "key": "XXXXXX", "mac": "", "category": "sfkzq", "product_name": "Smart irrigation systems", "product_id": "xnajzurgqo1ugohn", "biz_type": 0, "model": "401303", "sub": true, "icon": "https://images.tuyaeu.com/smart/icon/ay1530692932059RsnDv/a31dad76bed3999b3324e83d9abb4935.png", "uuid": "bfa64369996a901e49tvfn", "node_id": "AB1", "mapping": { "101": { <---> { "name": "Centro Inteligente Garza", "id": "bf72362a6f1f2ea9a3dvyq", "key": "XXXXX", "mac": "cc:8c:bf:0e:b9:ca", "uuid": "8ab0e748b10c5168", "sn": "100069232005D5", "category": "wg2", "product_name": "Garza Smart HUB", "product_id": "ixckfr3zke5fgach", "biz_type": 0, "model": "401303", "sub": false, "icon": "https://images.tuyaeu.com/smart/icon/ay1530692932059RsnDv/f105f6f1d67af0e3bd217acce5d3cf0d.png", "mapping": {}, "ip": "192.168.XXX.XXX", "version": "3.3" }
`
Confirmation
[x] I am sure this is a bug, or improvement that is well enough described that it can be implemented
[X] If this is for a specific device, the device config is mentioned above, or diagnostics are included.
[X] This is not requesting addition of a new device