leeyuentuen / localtuya

local handling for Tuya devices
GNU General Public License v3.0
71 stars 17 forks source link

Problem adding Sub-Devices #61

Open leofuscaldi opened 1 year ago

leofuscaldi commented 1 year ago

Hi,

i came across following the trails left for the problem "Localtuya with Zigbee devices". My gateway is v3.4 so I had to go with your beta versions of 3.7 to add it and try to add sub-devices. I installed 3.7beta2 and managed to add my Zigbee Gateway. That was as far as I could get. Then I went for the last version available at moment, beta10, moved back to beta9... and in all I got the same problem when adding the sub-devices: 1 - I add a localtuya 2 - choose (sub-device) 3 - It shows a screen with the Parent Gateway selected. I put a name and the device ID. Didn't figure out yet what is this hw_version or where to get it. Even tried writing 3.3 and 3.4 but the outcome is the same: on the next screen, goes to Add Data Point saying that the detection failed and asking for a number. I found a post which tells me to go here https://us.iot.tuya.com/device/log, put the Device ID on the first field, select the correct datacenter and click on search. Then, when we click on Please input function point ID it lists the Datapoints. I manually added them to the settings but they don't pull any value from the modules.

How should I proceed now?

Have a large number of devices such as Light Switches (modules), Thermostat valves, Sensors (Temp/Hum, Water leak, door), and also some bluetooth devices, which I'd like to make their way to the localtuya platform and to my HA.

Thanks in advance

alexualbu commented 1 year ago

@leofuscaldi , you should use at least beta9 - then the only thing you need to add the sub-device is the cid: in the developer console (the site you used) go to Cloud/api explorer and use the Device information api where you enter your device id. From here grab the node_id image

leofuscaldi commented 1 year ago

Dear @alexualbu, indeed, it worked as you instructed, I could add all my zigbee devices. But some didn't work,

For the light switch modules modules, I have the ID's 1, 7 and 14 only and none of them Switches the light on/off, they just get the status of the light.

The water leak sensor, according what I found on tuya site, should have 3 entries, but only the one for the battery is being recognized.

The same with the Bluetooth Fingerbot, only have the value for the battery level.

All other worked.

Can I help anyhow with logs to have those working...?

Anycubic commented 1 year ago

@leofuscaldi please be aware that if you try to add a device right after you switched it on not all of the IDs are recognised, I guess it is due to how zigbee protocol works, same thing like yours happened to me with my TRV valves. I guess each ID value needs to be updated at least once before it can be recognised when adding a device, hope this helps.

leofuscaldi commented 1 year ago

@leofuscaldi please be aware that if you try to add a device right after you switched it on not all of the IDs are recognised, I guess it is due to how zigbee protocol works, same thing like yours happened to me with my TRV valves. I guess each ID value needs to be updated at least once before it can be recognised when adding a device, hope this helps.

Hi @Anycubic, i don't think it's my case. My devices are working for months already, but I've been using Smart life so far.... But thanks anyway for the suggestion!

alexualbu commented 1 year ago

@leofuscaldi , i can confirm what @Anycubic says - some devices to not advertise the status for DPs if they have not been touched in a while (i have TRVs same as him, and after a while if the value doesn't change they simply to dot appear in the payload when queried). You can have them appear after you touch them from smartlife or some other way. But don't forget that the DPs are detected when the device is first added in localtuya and saved in HA. You can validate what DPs are advertised by using a third party tool like tuyaapi-cli. The lights might be a different story - there's a conversation in another issue with the same problem: light switch cannot be controlled. https://github.com/leeyuentuen/localtuya/issues/39#issuecomment-1518709972

leofuscaldi commented 1 year ago

For what I could test, I can Read status of almost everything I have on my Zigbee/Bluetooth Gateway, what I can't is control anything. Tried light (Zigbee) and a fingerbot (Bluetooth) and controling these devices wasn't possible. But for reading all devices, basically I just changed their values (Opened the door for door sensor, tampered the sensor for the Water Leak, forced changing the temperature on the T/H sensors and so on).

Hopefully soon we'll be able to also control lights and other devices.

alexualbu commented 1 year ago

@leofuscaldi - so you have tried tuya-cli?

caco3 commented 1 year ago

Deleted I had an old version installed, after updating to beta10 it goes one step further. Now I hang at the data point issue (like https://github.com/leeyuentuen/localtuya/issues/64)

Gyosa3 commented 1 year ago

Hi I got the data point issue when I was trying to register the sub device with the device ID in the config field "deviceID".

Here is what worked for me:

for me it worked, and it found all DPs and even more than advertised by the tuya dev portal !

All entities are created correctly and update well when device is manipulated in the Tuya app, however as reported in another issue my device cannot be controlled at this stage by HA directly for still obscure reasons.