Hacker News new | ask | show | jobs
by JoshuaRedmond 851 days ago
Have you considered Zigbee2mqtt[0]? You'd be running an extra program, but the docs are really good, it's pretty lightweight, and MQTT is incredibly easy to talk to from python or basically anything else. It's compatible with HomeAssistant (which is how I use it), but can be used standalone without having to run HA at all. It also means you don't have to handle the weird idiosyncrasies between different manufacturers.

[0] - https://www.zigbee2mqtt.io/

1 comments

This is the way to go. Z2M makes interoperability trivial. Just publish to MQTT.
I didn't play with it because I wasn't sure if every sensor out there is natively MQTT capable? ANd if it is, it still has to document the topics it responds to, right? For example, I have a Sonoff temp sensor, how do I know what topic it publishes to and how do I query it? The documentation said nothing about MQTT.
I’m happy to tell you that you are fundamentally misunderstanding. This is good because reality is even simpler.

Z2M takes ordinary Zigbee devices, and generates MQTT messages from them. The devices are oblivious to this, and have no idea what MQTT is. They just act like Zigbee devices.

Z2M just publishes messages on a dedicated topic per device, with all the relevant information in that message. Generally for battery powered devices like temperature sensors, you won’t “query” their state by asking the device - because they sleep with the radio off. Instead you just wait for an update (and store it as needed).

Docs for your device : https://www.zigbee2mqtt.io/devices/SNZB-02.html

Zigbee2mqtt has a huge number of supported devices (here's their official list [0]), which can also be expanded if the existing mappings don't work.

It took me a minute to find, but the full MQTT structure is detailed here [1], and then individual devices detail what they expose on their page (e.g. this [2] is a random Sonoff temperature sensor). This means that the topic "zigbee2mqtt/sonoff-temp-example" will just have a simple JSON message with '{"humidity":46.93,"temperature":21.73, ...}'.

Hope this helps!

[0] https://www.zigbee2mqtt.io/supported-devices/

[1] https://www.zigbee2mqtt.io/guide/usage/mqtt_topics_and_messa...

[2] https://www.zigbee2mqtt.io/devices/SNZB-02.html