dresden-elektronik / deconz-rest-plugin

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

New Xiaomi sensors #57

Closed NisseDILLIGAF closed 7 years ago

NisseDILLIGAF commented 7 years ago

So I bought some new Xiaomi sensors... one Xiaomi Aqara Temperature Humidity Pressure Sensor (which I got working, see below) and one Xiaomi Mi Smart Home Door / Window Sensors

There is a strange thing with the door sensor... it's got Manufacturer Code 0x0000 !? Maybe It's not an original?

anyways, this is what I got in deCONZ http://imgur.com/h6aSOtk http://imgur.com/IiAIAvw http://imgur.com/EhMNszo (gif of when I move the magnet from/to sensor)

I got the Xiaomi Aqara working after adding some code... this is the patch files for the Xiaomi Aqara Temperature Humidity Pressure Sensor https://gist.github.com/NisseDILLIGAF/fca6f06153a36bcd8f8b5cf80ab81605 I hope I got it right... It looks like it's working :) I get the three sensor values in REST

By the way... whats new in deconz-2.04.54-qt5.deb , it's not on github...

ebaauw commented 7 years ago

What is your experience with the Aqara temperature sensor? My 'original' one doesn't update very often. Maybe once in 8 hours. Does it only update on significant changes?

Looking at the web socket notifications, the Xiaomi Aqara weather sensor (temperature, humidity, pressure) sends updates throughout the night.

Sun Aug 20 2017 02:23:26: /sensors/346/state: {"lastupdated":"2017-08-20T00:23:26","temperature":1504}
Sun Aug 20 2017 02:23:26: /sensors/347/state: {"humidity":8326,"lastupdated":"2017-08-20T00:23:26"}
Sun Aug 20 2017 02:56:06: /sensors/346/state: {"lastupdated":"2017-08-20T00:56:06","temperature":1454}
Sun Aug 20 2017 02:56:06: /sensors/347/state: {"humidity":8428,"lastupdated":"2017-08-20T00:56:06"}
Sun Aug 20 2017 03:42:21: /sensors/346/state: {"lastupdated":"2017-08-20T01:42:21","temperature":1432}
Sun Aug 20 2017 03:42:21: /sensors/347/state: {"humidity":8466,"lastupdated":"2017-08-20T01:42:21"}
Sun Aug 20 2017 04:27:15: /sensors/346/state: {"lastupdated":"2017-08-20T02:27:15","temperature":1411}
Sun Aug 20 2017 04:27:15: /sensors/347/state: {"humidity":8448,"lastupdated":"2017-08-20T02:27:15"}
Sun Aug 20 2017 05:24:54: /sensors/346/state: {"lastupdated":"2017-08-20T03:24:54","temperature":1383}
Sun Aug 20 2017 05:24:54: /sensors/347/state: {"humidity":8471,"lastupdated":"2017-08-20T03:24:54"}
Sun Aug 20 2017 06:48:51: /sensors/346/state: {"lastupdated":"2017-08-20T04:48:51","temperature":1385}
Sun Aug 20 2017 06:48:51: /sensors/347/state: {"humidity":8597,"lastupdated":"2017-08-20T04:48:51"}
Sun Aug 20 2017 07:22:13: /sensors/346/state: {"lastupdated":"2017-08-20T05:22:13","temperature":1424}
Sun Aug 20 2017 07:22:13: /sensors/347/state: {"humidity":8540,"lastupdated":"2017-08-20T05:22:13"}
Sun Aug 20 2017 07:39:18: /sensors/346/state: {"lastupdated":"2017-08-20T05:39:18","temperature":1475}
Sun Aug 20 2017 07:39:18: /sensors/347/state: {"humidity":8550,"lastupdated":"2017-08-20T05:39:18"}
Sun Aug 20 2017 07:55:23: /sensors/346/state: {"lastupdated":"2017-08-20T05:55:23","temperature":1511}
Sun Aug 20 2017 07:55:23: /sensors/347/state: {"humidity":8465,"lastupdated":"2017-08-20T05:55:23"}
Sun Aug 20 2017 08:14:20: /sensors/346/state: {"lastupdated":"2017-08-20T06:14:20","temperature":1562}
Sun Aug 20 2017 08:14:20: /sensors/347/state: {"humidity":8344,"lastupdated":"2017-08-20T06:14:20"}
Sun Aug 20 2017 08:37:57: /sensors/346/state: {"lastupdated":"2017-08-20T06:37:57","temperature":1613}
Sun Aug 20 2017 08:37:57: /sensors/347/state: {"humidity":8114,"lastupdated":"2017-08-20T06:37:57"}
Sun Aug 20 2017 08:53:41: /sensors/346/state: {"lastupdated":"2017-08-20T06:53:41","temperature":1663}
Sun Aug 20 2017 08:53:41: /sensors/347/state: {"humidity":7948,"lastupdated":"2017-08-20T06:53:41"}
Sun Aug 20 2017 08:58:53: /sensors/346/state: {"lastupdated":"2017-08-20T06:58:53","temperature":1716}
Sun Aug 20 2017 08:58:53: /sensors/347/state: {"humidity":7890,"lastupdated":"2017-08-20T06:58:53"}
Sun Aug 20 2017 09:07:06: /sensors/346/state: {"lastupdated":"2017-08-20T07:07:06","temperature":1766}
Sun Aug 20 2017 09:08:57: /sensors/346/state: {"lastupdated":"2017-08-20T07:08:57","temperature":1819}
Sun Aug 20 2017 09:08:57: /sensors/347/state: {"humidity":7544,"lastupdated":"2017-08-20T07:08:57"}
Sun Aug 20 2017 09:09:38: /sensors/346/state: {"lastupdated":"2017-08-20T07:09:38","temperature":1872}
Sun Aug 20 2017 09:09:38: /sensors/347/state: {"humidity":7473,"lastupdated":"2017-08-20T07:09:38"}

Note that pressure is missing, since deCONZ doesn't update this attribute. It looks like the sensor is smart enough to send multiple reports once it's awake (unlike the Hue motion sensor, which uses separate scheduling for presence, lightlevel and temperature. I see no pattern in the timing, indeed, it would seem it only sends reports once a threshold for change has been crossed. Note that at 9:07, only the temperature is sent - I assume bacause there was no change in humidity.

Normally, this would be configured through the ZigBee attribute reporting configuration

This seem to be hard-coded in the sensor (and, in fact in all Xiaomi devices I've seen) - they don't support reading not writing the attribute reporting configuration.

As to the precision of these sensors: I placed one in the bathroom, where I have a Hue motion sensor measuring temperature, and an old-fashioned, unconnected, consumer-grade, digital thermo/hygrometer. I placed the other one on my balcony, comparing it to the temperature and humidity I pull from Wunderground. The Aqara's temperature seems to be a bit high (1-2 ºC), the humidity seems more or less accurate (within 2%).
Then again, I never had two Hue motion sensors report exactly the same temperature, even when placing them right next to each other. "With one watch a man knows what time it is, with two he's never sure".

ebaauw commented 7 years ago

I don't get web socket notification for the ZHAPressure, and the state object in the sensor resource remains empty. There's no Added ZCLvalue 0x0403/0x000 message in the log. After restarting deCONZ, state.pressure is populated, but remains 0. state.lastupdated is 1969-12-31T23:00:00.

That's because the attributes for 0x0403 are missing from general.xml, see #127.

Hypfer commented 6 years ago

I can't get the Xiaomi Mi Smart Home Door / Window Sensors to work with DeCONZ 2.04.81

image

manup commented 6 years ago

Please try again with 2.04.82, will be available later today.

manup commented 6 years ago

2.04.82 is up: http://www.dresden-elektronik.de/rpi/deconz/beta/deconz-2.04.82-qt5.deb

Hypfer commented 6 years ago

I found out why it didn't work: You need to to connect both parts of the sensor while adding it to the network otherwise it will fail.