Zigbee2mqtt: getting rid of your proprietary Zigbee bridges (Xiaomi, Hue, TRADFRI)

Could someone maybe recommend a store to get the hardware from? When buying at aliexpress, I and up with a cheap price of 39$, however the delivery time to germany will be 20-40 days, as well as the delivery time beeing different for the different parts. So maybe I will end up with all the parts somewhen in november :roll_eyes:

Iā€™d like to get to business a bit sooner, if possible.

Thanks for clearing that up for me. I take it tap should then be workingā€¦ not sure why itā€™s not exposed for me.

For the debugger, cable and usb stick? Iā€™m from The Netherlands and I spent. ā‚¬26 on Ali. Still waiting for it to arive though.

Hi,

Using hass.io and adding devices to shepherd-converters is not a trivial task, and there is no short / clean way ATM. Using a -separate- local install on a laptop seems to be the best route for nowā€¦


Hi Ekin

Thanks for the info. Have you seen anyone document the steps required to modify the hassio_zigbee2mqtt docker container?

This is as far as I gotā€¦

1. Enabled developer access to the hassos host  
https://developers.home-assistant.io/docs/en/hassio_debugging.html

2.Opened an interactive session
docker exec -it <CONTAINER ID/NAME> bash

3.Edited devices.js

4.Tried to do NPM restart (Not sure if it was the right thing to do)
I then got errors about access to /dev/ttyACM0 (It looked like it was in use)

5. I then used docker commit to create an "updated image"
I stopped the zigbee2mqtt container and tried to start my modfied container but got the same access error to /dev/ttyACM0

I am sure these products have increased in price since this project became popular!

I waited a long time, got so frustrated with waiting for the programmer I ordered another and they both turned up a day apart.

Local (NZ) suppliers wanted an awful lot for the same hardware.

It published with the topic therefore also in the mqtt sensors created by discovery. In your case is reporting 100% from what you mentioned earlier which is correct.

@subzero79 Iā€™m not sure what you mean by your reply to that other poster. Like him, all of my Xiaomi sensors (3 door, 1 occupancy, 1 temperature) are all reporting 100% battery level which doesnā€™t seem accurate? All other sensors (zwave) that donā€™t use Zibee2mqtt are less than 100%.

The battery ā€˜voltageā€™ is compared to 3v from memory.
Itā€™s only when the reported voltage is lower than 3v does it beginning to go below 100%.
I have 1 or 2 Xiaomi sensors at 95%.

If you look at the sensor data, they are reporting 3.0 -> 3.2v, hence why they appear stuck at 100%.
My guess is if the comparison voltage was 3.3v it would be closer to being accurate.

Someone needs to get a sensor and hook it upto a powersupply and graph input voltage to reported voltage to get an accurate ā€˜reportā€™ and determine how off the Xiaomi circuitry is.

Oh ok, thank you for that. I modified the template to divide the voltage by 3300. Am now getting realistic numbers from 91% to 93% for my Xiaomi battery sensors.

I believe thereā€™s three versions of the Cube:

ā€˜Miā€™ version (Mi logo on the side)
ā€˜Aqaraā€™ v1 (Aqara logo on the side)
ā€˜Aqaraā€™ v2 (2017 model) which looks identical to the first version.

I think they may have different model numbers within z2m? I have only tried the one original Aqara model.

Then I think its also firmware dependent from the Mi app,they could add and remove as they please :expressionless:

Then the z2m converters have to be written to support then.

Regarding battery health indicationā€¦

Many devices use CR3032 batteries and they have an official start voltage of 3.00 Volt under tiny load. But batteries are chemical devices so sometimes it is somewhat above 3.00 Volt, so IMO above 3.00 V is also 100%. Also they degrade fast below 2.7 Volt so that should be regarded als almost empty. 2.75V or 2.80V is probably wiser as the low limit for battery health.
See the graph (voltage vs. duration) on page 4 of this CR3032 specsheet pdf

Probably many devices (e.g. Xiaomi sensors) are designed to stop working below 2.6 or 2.5 volt. But I have never tested this because of lack of a precise calibrated power supply.

The difference in battery health indication of devices in e.g. Xiaomi Aqara Gateway versus Zigbee2mqtt is a result of a different calculation. In the Xiaomi gateway software the battery health is calculated between 3.30 Volt - 2.80 Volt so therefore new sensors almost always end up with a health of > 50% which is IMO not correct. (in xiaomi_aqara.py -> percent = ((voltage - min_volt) / (max_volt - min_volt)) * 100)

In Zigbee2mqtt it is better represented as 100% when it is 3.00 volt or above.

With the help of above links (message from @subzero79) I saw that in Zigbee2mqtt (https://github.com/Koenkk/zigbee-shepherd-converters/blob/master/converters/fromZigbee.js) it was recently changed to :

const battery3V = {
min: 2700,
max: 3000,
};

A wise decision imo!

1 Like

I want to know whether or not, openHAB works with zigbe2mqtt sniffers. (Is it possible to connect these devices to openHAB? So that the traffic can be captured in openHAB)

const battery3V = {
min: 2700,
max: 3000,
};

Am I understanding correctly that the % returned would be 99% if the voltage drops to 2997 and would be 0% when the voltage drops to 2700?

correct. 321

If (openhab use mqtt? ) ==> yes

As far as I interpret the code correctly it is as you wrote.

I think since all of my sensors are showing well above 3000 voltage, I will set the maximum to the sensor with the highest voltage which is 3075. Therefore for my battery sensor template I will use:

{{ ((value_json.voltage - 2700)/(3075-2700) * 100) | int }}

If anyone thinks this is a bad idea, please let me know.

[post deleted]

Did you ever figure out how to pair the Aqara WXKG02LM double switch? Iā€™ve been able to pair everything else but this one keeps failing for me.