Zigbee Mqtt

0 views
Skip to first unread message

Dunstan Jomphe

unread,
Aug 4, 2024, 10:35:40 PM8/4/24
to pertrelover
Anyhowgot it all working. I have Mosquitto mqqt broker running as I installed it for another reason (to get remove PC-shutdown working) so already have an mqtt user and password, so, followed the youtube vid I was watching and pumped the output of Zigbee2mqtt through to Mosquitto mqtt and it works fine.

the MQTT broker is just the go between/link that allows all of the various MQTT based data to be transmitted between the various MQTT clients (HA, zigbee2mqtt, etc) via publish and subscribe configurations.


To be honest, when I started with Home Assistant (a few years back), I thought it as so complicated that had to I blindly just followed YouTube videos. Never occurred to me, until recently, that ZHA existed as an alternative.


Because the add-ons run as separate processes listening on their own network ports, allowing separate communication to take place. In the case of z2m which is talking directly to your devices, it can receive messages directly from another process (node red) and send off to your light bulbs, etc.


HA is just a client, the same way the NodeRed is. Both listens to the same mqtt topics, both sends data to the same topics to control zigbee devices. And there might be more such clients from simple utility applications like MQTT explorer up to another home automation system (test instance of HA, or other software)


For example NR commands a zigbee light to turn on setting dedicated topic in mqtt. Light (or z2m- depending on a strategy) confirms the light is turned on by setting another topic. this way all listeners get to know that the light has been turned on.


So assuming i buy sonnoff devices from now one (looking into motion sensor now) what would you buy today as a zigbee controller if you were starting out? I understand that after that i will pick things that are zigbee certified.


I just set up my home assistant server today and started out by connecting my IKEA Tradfri LEDs and Aquara Sensors to HA via Zigbee2MQTT with the Sonoff ZigBee Stick. While I had some issues with the initial connection to z2m, it eventually did work.

However, while all my connected devices show up in the z2m frontend, they devices are not available in Home Assistant.


I am using the Zigbee2MQTT addon on a fresh install of home assistant OS and the mosquitto addon as well. When connecting to Mostquitto via MQTT Explorer everything seems to work fine as well. I have restarted every addon and the complete host, but still no success.


Thanks everyone for helping out! Unsurprisingly, this turned out to be a user issue. While I did install the mosquitto addon, I completely forgot to configure it. So while the MQTT server was running and z2m was communicating properly, the MQTT Addon did not advertise the newly discovered devices to Home Assistant.


I had the same problem.

I just did that: homeassistant true", and restart zigbee2mqtt addon and MQTT HA started to recognize zigbee devices. I had already configured MQTT HA with auto recognition.

Thanks


If I'm not misunderstanding the documentation though, all you're really doing is replacing a singular hub, with a Pi running a hacked Zigbee stick (thus creating a hub), and then running MQTT as your sort of interface link layer.


Great to know. I have mine in a docker instance on the same rpi as my Hassio instance. I was worried that it might be an issue as my system grew but I feel a bit better now. It's a pi4 4GB so I think I'm good for the time being.


I did this but too many of my zigbee devices lacked attributes. I asked how to add quirks but no one answered me and I gave up. I couldn't add the ikea 5 button remote and certain sensors lacked temperature readings.


If it pairs, you may be able to monitor zha events for each button press and design an automation to act on that event. That was what I did...until the latest release (this week) that updated hassio support for button devices...now it just exposes the button pressed, double clicked and held options as expected.


The Smartthings button was not reliable enough for me. My family approval factor dropped because ZHA with the Smartthings button has an issue sending multiple events or not sending events. I swapped it back to HE and works much better.


The problem with this device is that it's solidly entrenched in touch link, so it is only capable of broadcasting it's commands over a hard coded group ID, unless it's likned to another device (Maybe, I gave up on it when binding to its clusters didn't change its behaviour). Most hubs incliding HE are just going to ignore these frames.


I saw messages from the author of ZHA asking Koenkk of zigbee2mqtt to share the solution. I guess ZHA might also be able to do the Ikea remote? I was never able to get it working with ZHA though. I assumed it was a hardware issue.


@helene7t7 You can pair with Hue bridge. And apparently it works with the SmartThings hub with this DTH. I had a workable solution a few years ago (no DTH available at that time), but really it was similar to this method with the Hue bridge. Where it was really the touch link pairing that was controlling the bulbs from the remote, and the hub was simultaneously paired to the bulb. You had control from both the hub and remote, but no communication between the hub and the remote. This is how I currently have 6 Lutron Connected Bulb Remotes paired to my Hue bridge and the associated bulbs at the same time. Not perfect, but functional.


To follow up my last post, integrating a newly flashed Tasmota Zigbee Coordinator with Home Assistant has a third option besides ZHA and Zigbee2MQTT; it can be used directly as a Zigbee Coordinator using its own amazing Tasmota Software.


The device itself uses a zigbee implementation called Zigbee2Tasmota, which is a full-fledged zigbee routing platform with the usual MQTT integration. Unfortunately, it is probably overlooked because its use is limited to the Tasmota console, but it may be an attractive option for some, especially for a potentially more reliable connection when relying on the WiFi radio of the Sonoff Zigbee Coordinator.


To solve this, I began splitting up my various services and really only have my plex server, my backup pihole, home assistant plus many other non-critical services on my ProxMox box now. I got a number of cheap Zotac mini-pcs from Amazon Warehouse and have begun using them to run baremetal services like OPNsense, zigbee/zwave radios, NVR, MQTT server, etc.


Back to my point, I did not initially enjoy turning my Tasmotized Zigbee Coordinator into a Home Assistant Zombie. When you integrate the Zigbee coordinator into ZHA, you lose all native Zigbee commands of the coordinator.


In an effort to further decentralize my smart home infrastructure, I would prefer for the zigbee coordinator to maintain functioning even if my Home Assistant instance goes down. Having said that, the device now becomes dependent on a functioning MQTT server so that is certainly a trade-off. I personally keep my MQTT server running on my NAS so that it is always up. I also have a second instance of Home Assistant which meant that I could only integrate the coordinator natively with one instance, whereas when the connection is over MQTT, it can connect to an unlimited number of Home Assistant Servers. I also think an MQTT server is more stable than a WiFi serial over TCP connection. I subjectively and anecdotally noticed a quicker reaction time with Zigbee2Tasmota vs ZHA.


Second, based on my testing and internet research, it is really not possible to change the Zigbee channel from 11 when integrating the Zigbee Coordinator in ZHA. I have a Hue Hub and WiFi channels 1, 6, and 11 throughout my home and so for me, the ideal channel was 20. With Zigbee2Tasmota, this is a trivial command.


Third, I purchased a number of cheap Sonoff and Aqara sensors without realizing the issues I would have when trying to pair them with standard Zigbee coordinators. I had many drop offs requiring a physical reset on the device when on ZHA, but the devices all just seemed to work with Zigbee2Tasmota. Now, this could be related to my second point and while on ZHA, there just may have been too much interference, but changing the channels of my other devices was not a viable option for me.


First, all commands are done through the console except Zigbee Join and viewing the Zigbee Map, as you can see below. I suppose that negative depends on the individual, but it is certainly a nice option to have an easy to use GUI nicely integrated into Home Assistant. However, I should note once devices are added, they are listed on the main Tasmota page along with their current state, connection strength, battery level, etc.


Second, along with all Zigbee network controls requiring commands through the Tasmota terminal, adding devices into Home Assistant also required manually configured MQTT entities and Template entities. Again, may or may not be a big deal. I will show some examples of my devices below. Honestly, once one device was written, it was trivial to copy and paste an additional device.


Each device is given a unique identifier when it joins the network, and that is used to initially populate the MQTT topic if you decided to make the change I suggested above, but there is fortunately a way to give friendly names to each device.


Once you do that, the device friendly name will display on the Tasmota home screen, and you can set SetOption112 to 1 so that the friendly name will be used in the MQTT topic instead of the unique identifier.


Here are some examples I made to control various devices. Like I said above, the MQTT topic for each device will now be tele/Zigbee//SENSOR. I set my topic to zbbridge in Tasmota, so change yours accordingly along with the device names. I did my best to bold the device-specific names and options below.


The same is true for the Aqara Humidity and Temperature Sensor I use. Each message did not have ever variable and so it was important to only update the MQTT entity when the message had the necessary information. Also, to note, the temperature was reported in Celsius to Tasmota and so I had to add a freedom conversion to my MQTT entity for Fahrenheit.

3a8082e126
Reply all
Reply to author
Forward
0 new messages