zigbeefordomoticz / z4d-certified-devices

GNU General Public License v3.0
4 stars 6 forks source link

[Model Certification] - Tuya Smart Zigbee Rain Sensor With Light Detector (TS0207-waterleak) #72

Open j-b-n opened 2 months ago

j-b-n commented 2 months ago

Tuya Smart Zigbee Rain Sensor With Light Detector Solar Operated IP66 Outdoor Waterproof Rain Detector

export.json

waltervl commented 2 months ago

I just wanted to make an issue for this device too :-)

TS0207
_TZ3210_tgvtvdoc

I made an export with tuya debug already switched on: errors_rainsensor.json.txt

So it would be nice if instead of a Waterleak switch it would be a switch with name 'Droplet Detection (Raining)' Also for the other devices a custom sensor would be created with value mV (there is no default mV device in Domoticz) ('illuminance', ea.STATE).withUnit('mV').withDescription('Illuminance level'), ('illuminance_average_20min', ea.STATE).withUnit('mV').withDescription('Illuminance average for the last 20 minutes'), ('illuminance_maximum_today', ea.STATE).withUnit('mV').withDescription('Illuminance maximum for the last 24 hours'), ('rain_intensity', ea.STATE).withUnit('mV').withDescription('Rainfall intensity')

And a switch for ('cleaning_reminder', ea.STATE, 'ON', 'OFF').withDescription('Cleaning reminder'),

pipiche38 commented 2 months ago

here is what I suggest:

Lux to monitor the current illuminance WaterLeak to inform about Rain or not (you can edit and change the image for exemple) RainingIntensity - will give you the raining intensity in mV SwitchCleaning - will inform if you need to clean

pipiche38 commented 2 months ago

For the Battery, we need to understand what is the value of the datapoint 0x04. In the export provided by @j-b-n I found a value of 0x53a -> 1338 , we might need to see how to translate that into Percentage of Battery ?

pipiche38 commented 2 months ago

This will be available at a point of time on the wip-stable7-7.1.13 branch

git checkout wip-stable7-7.1.13
git pull
sudo python3 -m pip install -r requirements.txt --upgrade
waltervl commented 2 months ago

Perhaps I was a little bit to early but wip-stable7-7.1.13 gave errors and plugin was not working, see below. Reverting back to stable7 made it working again (git checkout stable7)

2024-09-10 18:20:28.091 Status: ZiGate: Z4D starting with stable7-7.1.012 2024-09-10 18:20:28.098 Status: ZiGate: Z4D loads ZCL Cluster definitions 2024-09-10 18:20:28.127 Status: ZiGate: Z4D loaded 16 configuration from legacy database. 2024-09-10 18:20:28.130 Status: ZiGate: Z4D loads 17 configuration from the local certified Db. 2024-09-10 18:20:28.317 Status: ZiGate: Z4D loads 586 Certified devices from repository. 2024-09-10 18:20:28.318 Status: ZiGate: Z4D loading database 2024-09-10 18:20:28.563 Status: ZiGate: Z4D loads 39 entries from /home/udoox86/domoticz/plugins/Domoticz-Zigate/Data/DeviceList-8.txt 2024-09-10 18:20:28.609 Status: ZiGate: Z4D configured to use transport mode: ZigpyZNP 2024-09-10 18:20:29.913 Error: ZiGate: Call to function 'onStart' failed, exception details: 2024-09-10 18:20:29.916 Error: ZiGate: Traceback (most recent call last): 2024-09-10 18:20:29.916 Error: ZiGate: File "/home/udoox86/domoticz/plugins/Domoticz-Zigate/plugin.py", line 1539, in onStart 2024-09-10 18:20:29.916 Error: ZiGate: _plugin.onStart() 2024-09-10 18:20:29.916 Error: ZiGate: File "/home/udoox86/domoticz/plugins/Domoticz-Zigate/plugin.py", line 558, in onStart 2024-09-10 18:20:29.916 Error: ZiGate: start_zigbee_transport(self ) 2024-09-10 18:20:29.916 Error: ZiGate: File "/home/udoox86/domoticz/plugins/Domoticz-Zigate/plugin.py", line 992, in start_zigbee_transport 2024-09-10 18:20:29.916 Error: ZiGate: _start_zigpy_ZNP(self) 2024-09-10 18:20:29.916 Error: ZiGate: File "/home/udoox86/domoticz/plugins/Domoticz-Zigate/plugin.py", line 1062, in _start_zigpy_ZNP 2024-09-10 18:20:29.916 Error: ZiGate: from Classes.ZigpyTransport.Transport import ZigpyTransport 2024-09-10 18:20:29.916 Error: ZiGate: File "/home/udoox86/domoticz/plugins/Domoticz-Zigate/Classes/ZigpyTransport/Transport.py", line 18, in 2024-09-10 18:20:29.916 Error: ZiGate: from Classes.ZigpyTransport.zigpyThread import (start_zigpy_thread, 2024-09-10 18:20:29.916 Error: ZiGate: File "/home/udoox86/domoticz/plugins/Domoticz-Zigate/Classes/ZigpyTransport/zigpyThread.py", line 779, in 2024-09-10 18:20:29.916 Error: ZiGate: async def zigpy_request( self, device: zigpy.device.Device, profile: t.uint16_t, cluster: t.uint16_t, src_ep: t.uint8_t, dst_ep: t.uint8_t, sequence: t.uint8_t, data: bytes, *, ack_is_disable: bool = True, use_ieee: bool = False, extended_timeout: bool = False, ) -> tuple[zigpy.zcl.foundation.Status, str]: 2024-09-10 18:20:29.916 Error: ZiGate: TypeError: 'type' object is not subscriptable

pipiche38 commented 2 months ago

@waltervl not sure where this error is coming from. Is the plugin not starting at all ? can you share the full plugin log ?

pipiche38 commented 2 months ago

I just push some update to implement what is needed. You need to have 5.310 for the Certified Db to get the TS0207 Rain and Lux sensor.

Make sure to run the sudo python3 -m pip install -r requirements.txt --upgrade command to have the right level of zigpy library and if you downgrade to stable7, you need to do it to downgrade the zigpy libs as well.

waltervl commented 2 months ago

Updated the certified db and after re-pairing the device I now have 2 Domticz devices: The TS0207-rain-detector_Water switch and the TS0207-rain-detector_Lux. Still missing the 20min average lux, the rain intensity mV sensor and the cleaning switch. export(6).json

pipiche38 commented 2 months ago

Thanks @waltervl for testing it. Few comments:

When I look the export you provided, I expect to have Lux/Water/RainIntensity/SwitchCleaning widgets created. Is there any error in the logs (plugin, domoticz ) ? Can you enable debug "Pairing" and "WidgetCreation" and redo then pairing ?

waltervl commented 2 months ago

I will test this evening with pairing logging. The 20 minute avarage lux would be very usefull to steer something on sunshine. So your blinds will not retract on 1 small cloud.... Also rain intensity would be helpfull to have to help identify how heavy it rains.

pipiche38 commented 2 months ago

@waltervl when doing your test, make sure to get the latest of the wip-stable7-7.1.13 and do an update of the Certified Db to run 5.311

waltervl commented 2 months ago

I tried again with pairing and widget debug on (result still the same, only 2 devices created). PluginZigbee_pairing.log

I also again tried to update to wip-stable7-7.1.13. The update (git checkout and requirements upgrade) goes fine, no errors. But after restarting the system Z4D will not start (cannot connect to the coordinator). see the log Error_Z4D_wip-stable7-7.1.13.log

When reverting back to stable7 it goes fine again (see the pairing log).

waltervl commented 2 months ago

@waltervl when doing your test, make sure to get the latest of the wip-stable7-7.1.13 and do an update of the Certified Db to run 5.311

log with db 5.311 (but on stable7), still only 2 devices. PluginZigbee_pairing_db5311.log

j-b-n commented 2 months ago

I changed branch etc but I can't really see that in the logs (but I might be missing something) however it worked and I now got these devices:

Z4D - TS0207-rain-detector_Lux-a4c1385c7f3f1429-01 Z4D - TS0207-rain-detector_Lux20MinAverage-a4c1385c7f3f1429-01 Z4D - TS0207-rain-detector_Water-a4c1385c7f3f1429-01 Z4D - TS0207-rain-detector_RainIntensity-a4c1385c7f3f1429-01 Z4D - TS0207-rain-detector_SwitchCleaning-a4c1385c7f3f1429-01

I get some errors but I guess that is for another device: _PluginZigbee_24.log

Export: export.json

ps. I get this from the prompt: ` sudo git rev-parse --abbrev-ref HEAD

wip-stable7-7.1.13`

pipiche38 commented 2 months ago

@waltervl I have the impression that you are running python3.8 with Domoticz

Python Version: 3.8.10 (default, May 26 2023, 14:05:08) \n[GCC 9.4.0]

Can you confirm ? I guess you have an error message in Domoticz log.

waltervl commented 2 months ago

Yes running Python Version: 3.8.10 (default, May 26 2023, 14:05:08).

What kind of error message you would have expected about Python and Z4D? I don't see it.

waltervl commented 2 months ago

@j-b-n Good that it is working for you. On what python version are you on?

j-b-n commented 2 months ago

@waltervl I am running Python 3.9.2.

waltervl commented 2 months ago

@pipiche38 On what python version is Z4D supported? Should I upgrade my system? I am currently on Ubuntu 20.4.6LTS

pipiche38 commented 2 months ago

python3.8 is end of support , so in all cases I encourage you to move to something more recent. I had a look to the code and for now, the plugin is checking that you are running >= 3.8 so it should be fine. I don't know what is wrong on your side, and why not all widgets are created. and then you have some issue at startup.

Are you using ZNP or EZSP as the Zigbee coordinator ?

waltervl commented 2 months ago

I am using ZNP as zigbee coördinator. I will try some more. Perhaps reboot after going to wip.

j-b-n commented 2 months ago

I hope you get it to work Walter. I am experiencing connection loss for some reason. I need to think about why (first I blamed the battery but the sensor seems to wake up when I either trigger "rain" or simply repair it).

Perhaps time to replace my Conbee II with a ZBDongle-E...

waltervl commented 2 months ago

I did not get wip-stable7-7.1.13 to work yet (did also not try hard yet). But I also see that the device disconnects frequently. It is currently very close to the coordinator and disconnects within a couple of days. I read it also somewhere else that it is not a very stable device.