dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 501 forks source link

[Device Request] Tuya Water leak sensor #7259

Closed YvesSun23 closed 1 year ago

YvesSun23 commented 1 year ago

Device

Bildschirmfoto 2023-09-24 um 18 45 51

Screenshots

Basic

Bildschirmfoto 2023-09-24 um 18 48 05

Identify

Bildschirmfoto 2023-09-24 um 18 56 21

Alarms

Device Temperature

Groups

Scenes

On/Off

Level Control

Color Control

Simple Metering

Diagnostics

Other clusters that are not mentioned above

Bildschirmfoto 2023-09-24 um 18 56 02 Bildschirmfoto 2023-09-24 um 18 56 39 Bildschirmfoto 2023-09-24 um 18 57 12 Bildschirmfoto 2023-09-24 um 18 57 34 Bildschirmfoto 2023-09-24 um 18 57 50
YvesSun23 commented 1 year ago

Sorry, I just saw that the device support has already been implemented. _TZ3000_TS0207_water_leak_sensor.json For some reason it is not displayed in Phoscon for me.

Mimiix commented 1 year ago

Sorry, I just saw that the device support has already been implemented. _TZ3000_TS0207_water_leak_sensor.json For some reason it is not displayed in Phoscon for me.

That is not the same one. The file you mention is not including your device as you can see https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/tuya/_TZ3000_TS0207_water_leak_sensor.json

@Smanar can you check in :)?

YvesSun23 commented 1 year ago

Yes, I just opened the file in the DDF editor and the manufacturer code is not included. Would it be enough to add the manufacturer code or do I have to create a completely new file? I am currently trying to get to grips with the description of the DDF files from Dresden Elektronik.

Mimiix commented 1 year ago

Yes, I just opened the file in the DDF editor and the manufacturer code is not included. Would it be enough to add the manufacturer code or do I have to create a completely new file? I am currently trying to get to grips with the description of the DDF files from Dresden Elektronik.

Yes, add your Manufacturer code and Model ID to the array (so the sizes match) Then it should work after re-pairing your device.

It should work if your device works the same way ofcourse :)

YvesSun23 commented 1 year ago

Perfect, I'll test it at the weekend, unfortunately I'm away on business at the moment. I will then let you know if it worked or not.

I have a question for understanding, as I have a few other cheap Tuya sensors, I would try to create my own DDF file. If I understood correctly, I have to enter the values from the individual clusters in the DDF editor etc. and create a new file. If I have done everything correctly and reconnect the sensor, then the DDF file is automatically loaded without me having to assign it manually? If everything is entered correctly, then the sensor should also be displayed in the Phoscon App?

Mimiix commented 1 year ago

Perfect, I'll test it at the weekend, unfortunately I'm away on business at the moment. I will then let you know if it worked or not.

I have a question for understanding, as I have a few other cheap Tuya sensors, I would try to create my own DDF file. If I understood correctly, I have to enter the values from the individual clusters in the DDF editor etc. and create a new file. If I have done everything correctly and reconnect the sensor, then the DDF file is automatically loaded without me having to assign it manually? If everything is entered correctly, then the sensor should also be displayed in the Phoscon App?

Translated with www.DeepL.com/Translator (free version)

Yes to most of it, but the last: Phoscon doesn't always show the sensors. However, it should show in the RestAPI. Phoscon said they should show all devices now, but i'll have to see that 😅

For help with a DDF, i recommend creating a device request and in there you'll get the help for that specific device. Additionally, you can also share the DDF for others to benefit :)

YvesSun23 commented 1 year ago

Good to know, if it is successfully included in deconz and not shown in Phoscon, then it certainly won't be visible in homkit either (Homebridge-deconz). I'll try to enter the manufacturer in the existing file first and then I'll get back to you. Thank you very much, that helped me a lot, slowly I understand deCONZ 🤪

Mimiix commented 1 year ago

Good to know, if it is successfully included in deconz and not shown in Phoscon, then it certainly won't be visible in homkit either (Homebridge-deconz). I'll try to enter the manufacturer in the existing file first and then I'll get back to you. Thank you very much, that helped me a lot, slowly I understand deCONZ 🤪

It should show in Homekit after you added it succesfully in deCONZ. The DDF is a whitelist aswell, so if you haven't applied it,the device wont be in the RestAPI.

Smanar commented 1 year ago

I'll try to enter the manufacturer in the existing file first and then I'll get back to you.

Yep, tuya create some device but generaly, it's just clone, so one DDF can work for 10/20 sensors, and lot of sensors work same too, so you have lot of chance for just adding your device will work. And as you have the same model id than the ones in the DDF linked by @Mimiix , more chances ...

You just need to add the manufacture name AND the model id (even they are all same). Then restart deconz (or make "hot relaod" in menu if you are using the GUI) and re-inclmude the device.

I m sure at 100% it will work with a text editor, but not it will work using the editor (I m not sure if it support multiple device)

To edit the DDF, it will depend of your OS.

YvesSun23 commented 1 year ago

I have now successfully edited the file /usr/share/deCONZ/devices/tuya/_TZ3000_TS0207_water_leak_sensor.json and added the manufacture name and the model id I did it directly via the terminal and the Nano Editor. Then I restarted the system and the sensor is connected but not recognised. Do I have to delete the node again and then reconnect the sensor? Unfortunately I can only do this on Friday, I made the changes via VPN and VNC from the hotel.

Smanar commented 1 year ago

What is your OS ? You are not using docker ?

If it have worked, you just need to re-include the device, deconz will use the DDF to reconize it (easy way, it's possible too using the GUI but more manipulation)

YvesSun23 commented 1 year ago

Its an RPi 3B+

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian

I will try to reinculde it on friday ;)

Smanar commented 1 year ago

So no problem on this OS. You have edited the deconz file, so at next deconz update the file will be overwrited, so no danger.

YvesSun23 commented 1 year ago

Thanks again for the help and the DDF crash course. The sensor was automatically integrated and assigned overnight without me having to do anything.

YvesSun23 commented 1 year ago

image

image

image

Smanar commented 1 year ago

So it's ok I can make the PR to submit the device ?

YvesSun23 commented 1 year ago

Sorry, what is PR 🙈 The device works fine, I have tested it and get a critical alarm in HomeKit if water is detected.

The only thing I am unsure of, is the battery capacity. I will swap the battery for a new one tomorrow and will see if the charge is displayed at 100%. No idea how long the sensor has been in storage. But for just under 7€ (Ali...) the sensor works really well.

Smanar commented 1 year ago

PR is that https://github.com/dresden-elektronik/deconz-rest-plugin/pull/7271

The battery level is take from the cluster 0x0001 (power configuation), attribute 0x0021 (battery percent)

DickenSerm commented 8 months ago

Hey, I also have a Tuya Water Sensor clone. Is it possible to record that too?

Manufacturer: _TZ3000_kstbkt6a

All other attributes and model identifier are exactly the same.

Smanar commented 8 months ago

It's effectively a clone. From Z2M

tuya.whitelabel('Aubess', 'IH-K665', 'Water leak sensor', ['_TZ3000_k4ej3ww2', '_TZ3000_kstbkt6a']),

https://github.com/dresden-elektronik/deconz-rest-plugin/pull/7549

DJF3 commented 8 months ago

Yesterday I received a Onenuo water sensor that is just like the one at the top of this issue. Except that mine has "Manufacturer Name" : _TZ3000_mugyhz0q

For now I have manually added it in the _TZ3000_TS0207_water_leak_sensor.json file. After restarting Deconz this sensor works fine.

sciorty commented 8 months ago

I have one of these sensors, but why don't I see the water state on the home assistant deconz device?

Schermata 2024-02-09 alle 23 11 04 Schermata 2024-02-09 alle 23 11 14 Schermata 2024-02-09 alle 23 11 19
sciorty commented 8 months ago

I have one of these sensors, but why don't I see the water state on the home assistant deconz device?

Schermata 2024-02-09 alle 23 11 04 Schermata 2024-02-09 alle 23 11 14 Schermata 2024-02-09 alle 23 11 19

Well... I just had to reload the deconz integration a few times:

Schermata 2024-02-09 alle 23 32 18
Smanar commented 8 months ago

Can take time before the device send the first report.