dresden-elektronik / deconz-rest-plugin

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

Tuya zigbee temperature sensor and Tuya zigbee motion sensor #2370

Closed jahodaradek closed 4 years ago

jahodaradek commented 4 years ago

Tuya motion tuya motion node info Tuya motion tuya motion Tuya temperature tuya temperature Tuya temperature tuya temperature node info

Sorry for the czech language but the you can see they are like xiaomi sensors just with tuya platform https://www.chytrevypinace.cz/ZigBee-PIR-Sensor-Pohybu-d155.htm https://www.chytrevypinace.cz/ZigBee-Sensor-Teploty-a-Vlhkosti-d154.htm Also they work with ZHA.

gesamtplan commented 4 years ago

I just added the temperature sensor to my rasbee and get data from it like described above. I am not so firm with the deconz app but I don't see the sensor in the phoscon app. Is this normal or am I making something wrong?

Some lamps and the Eurotronic thermostats are working fine with my Rapsberry Pi 3.

jahodaradek commented 4 years ago

Yup can be seen in deconz but not phoscon.

gesamtplan commented 4 years ago

Is there any chance to get them integrated in home assistant?

SwoopX commented 4 years ago

Folks, the devices will not be visible in Phoscon unless DE specifically integrates them. To see if they are available, check the REST API.

I did integrate one of those some weeks ago under a different name.

EDIT Just checked, it was the temperature sensor.

gesamtplan commented 4 years ago

How can I do this? Maybe i can get the adapt the rest api on HomeAssitant.

SwoopX commented 4 years ago

You may check it following this here https://github.com/dresden-elektronik/deconz-rest-plugin/issues/2121#issuecomment-564770517

What exactly do you want to adapt? Either the device ist supported and the sensors are being created or not. The API has pretty much nothing to do with it.

jahodaradek commented 4 years ago

I guess he wanted to ask if its possible to maybe create sensors by himself before the device is officially supported. I tried to compile your branch and replace the plugin but got into some errors image

SwoopX commented 4 years ago

Bug is fixed

gesamtplan commented 4 years ago

I am not so firm in compiling c-projects. I just saw them on the deconz gui and not in the phoscon app. So if the device is not supported yet it explains why there ist no sensor in the rest-api. Got that.

SwoopX commented 4 years ago

I am not so firm in compiling c-projects. I just saw them on the deconz gui and not in the phoscon app. So if the device is not supported yet it explains why there ist no sensor in the rest-api. Got that.

I'd rather put it that way: If a device is not supported, you should see it in deconz GUI, but must likely sensors are not created in REST API. If a device is supported, you see it in deconz GUI, sensors should be available through REST API but the device is not necessarily showing up in Phoscon.

gesamtplan commented 4 years ago

Is there a chance that the sensors are getting supported in a newer version of deconz?

SwoopX commented 4 years ago

I've already issued a pull request.

gesamtplan commented 4 years ago

Thank you.

gesamtplan commented 4 years ago

Works good in my environment. Three days for now without failure. Just compile the sources and then connect the Sensor again.

SwoopX commented 4 years ago

Sounds good to me. Do you get proper values for battery? I'd assume not and I probably need to amend it for other devices as well.

gesamtplan commented 4 years ago

Have checked the battery levels of my two sensors. One shows about 52% the other 74%. I don't know how long the sensors have been in stock in china and the batteries haven't been sealed as I got them.

Have just added a new battery in in on of the sensors and it still shows 52% How did u calculate?

gesamtplan commented 4 years ago

Temperature and Humidity are looking quite good and do not differ as much from a other sensor I use. Temperature compared 18.2 degC to 17.8 degC and humidity 51,4% to 47.1%. I don't believe what's behind the dot. Measuring temperature and humidity is quite complicated to get proper values. But it doesn't sound very implausible.

SwoopX commented 4 years ago

Interesting. Battery level is not properly displayed for a couple of sensors I previously integrated, that's why I was asking. But good to see that it's working on your end.

If you can provide a screenshot from power configuration cluster with read attributes, I can tell you. Right now, I assume it is based on battery voltage, not too accurate. Depending on when you exchanged the battery, it might take some time for the value to refresh.

gesamtplan commented 4 years ago

Had exchanged the battery and refreshed via the button on the sensor. HomeAssistant showed a refresh less then a minute. Maybe the sensor needs some time to middle the values or measure the new battery. I will look tomorrow. Thanks for ur help.

SwoopX commented 4 years ago

Np. Could you share the screenshot anyway? Thanks!

gesamtplan commented 4 years ago

I have to put a samba share on the Raspberry to do this. Maybe I have time tomorrow. But the battery level on the sensor increased to 100% a few minutes ago. :-)

SwoopX commented 4 years ago

Ok, that's a bit too much then. Just lemme know the values of attribute 0x0020 and 0x0021. Thanks and glad that it worked out so smoothly!

gesamtplan commented 4 years ago

The sensor with 100% shows on 0x0020 the value 30 and on 0x0021 the value 200. The second one shows on 0x0020 28 and on 0x0021 144. The RestAPI shows on the second one 72% which is half the hex value. Sounds plausible to me.

SwoopX commented 4 years ago

Jep, all good. Got to the wrong line of code here so great it all works.

gesamtplan commented 4 years ago

Where was the bug und have u checked in it yet?

SwoopX commented 4 years ago

No bug. Just wondered why it worked ok. Reason was looking at the wrong line of code. Everything's obviously as it should be.

abwyatt commented 4 years ago

Compiled from master and testing Tuya RH3040 Motion Sensor. Not appearing in Phoscon, but created sensor and battery device OK in JowiHue on HomeSeer.

SwoopX commented 4 years ago

@abwyatt Thanks for your feedback. Version .73 has officially been released since a few days. The device will not show up in Phoscon unless specifically implemented. This must be done by DE as it is closed source.

CarpeDiemRo commented 4 years ago

I have a PIR RH3040 and I have the following issue. It is successfully integrated into HA via DECONZ, not displayed in the DECONZ UI interface but appears as an entity in HA. So far, so good.

I observed the following unnatural behavior. a. The PIR doesn't detect motion continuously. EX. Detect the first movement and, even though the movement Is continuous in front of the sensor the PIR state turns to "off" b. After this transition, the PIR doesn't change to 'on' even though the movement reappears in front. If I press the side button the sensor sent the message to DECONZ and it is triggering again, but only for a short period of time. c. It is clear that the relationship with DECONZ as a coordinator is ok and has no problem. My assumption is maybe the PIR is broken. Do you have the same issue? Or maybe I did something wrong. Screenshot 2020-05-10 at 13 21 13

Mimiix commented 4 years ago

It seems this issue is resolved or otherwise inactive. If it is not, please re-open!

ghost commented 3 years ago

Hello,

I bought a Tuya smart Temperature sensor (zigbee version).

Visible in Deconz but not in Phoscon. By extension not visible by Homebridge Hue. If I understand correctly there are no solution to display the sensor on Homebridge ?

Thanks

Skare69 commented 3 years ago

I'm currently running version 2.10.04 / 14.3.2021 with firmware 26660700 and the Tuya temperature and humidity sensor is only visible in Deconz but not in the Phoscon App. It shows up in Home Assistant but as I can't change the name in Phoscon I have to change the device name in HA which is a bit tedious for a lot of sensors. I'd take a look at the code to fix this if anyone could give me a hint where to look (for the sensor not showing up in Phoscon).

Mimiix commented 3 years ago

@Skare69 phoscon needs to add support for it themselves.

You can use the rest api to change the name.