Why use a MQTT message broker as the centralized message bus?

Hi there!

Home automation has been a hobby for me for more than 10 years. I’ve tried out a number of different systems and programming languages. I moved to openHAB from Domoticz maybe 3-5 years ago. I’m very happy with my openHAB system not least because I can make my automation rules in my preferred language which is python. I’m very happy to see how well the Helper Libraries for openHAB Scripted Automation is evolving.

During the years I have automated and integrated with different systems and services. I’m well aware that openHAB has a lot of bindings that integrate with various hardware and all kinds of external systems. As it turns out, I have 15 running docker images. I have dockerized openHAB, grafana, influxDB, mosquitto among others. I also have docker containers that interfaces with other systems like my Wifi, MySensors, my Nibe heater, PV system and soon also a EV charger. Even though there might exist fine working openHAB addons for many of those systems, I have choosen to use my mosquitto MQTT message broker as the centralized message bus.

In my experience, the focus on MQTT has made working with my home automation a lot easier. Not only when upgrading/updating openHAB. It’s very easy to debug and I have even integrated a few systems without passing openHAB. The design makes each system is happily unaware about other systems, they just interface with MQTT. It feels kind of clean and things are workig great.

Lately I’ve had this crazy idea to make all my Z-Wave devices (about 65 nodes) talk MQTT instead. Now, why would I like to do something like that? Wouldn’t that be to just add an extra layer that would not only slow down the home automation but also introduce a whole bunch of errors?

While I feel appealed by the idea (is that even proper english? I don’t know) I’m sure there are others that think it would complicate things and that it’s a stupid idea. But I think I can’t let go of it. I think I need to try it out. For the purpose, I’ve found Zwave to MQTT gateway and Control Panel using NodeJS and Vue. I’ve been experimenting with it and it looks promising. It’s hard though because I haven’t found a good dedicated online community for it where users share experiences with each other. I do have some questions but I don’t know where to ask them really. However I learn more as the time passes.

The bottom line is that I’d like to MQTT-erize everything that’s possible. I created this topic maybe most for my self to sum up what’s going on and make clearer to myself… Please feel to reflect on the topic and respond with whatever comes to your mind.

Cheers!

2 Likes

So, my first thought is that one of the primary purposes of OH is to bridge between different technologies. So why not just bridge Zwave to MQTT using openHAB? With the event bus configuration (see MQTT 2.5 Event Bus) all it takes is a few lines of code (or download from the Helper Library if using Python) and a couple of Groups and all your zwave devices will be happily pub/subing to MQTT. And then you get to take advantage of the Zwave support in the openHAB binding, which, based on what I’ve seen written, is second to none in terms of number of devices supported and ease of use.

Personally, I think moving to something external to OH just to “MQTT All the Things!” seems like cutting off your nose to spite your face. It’s going to be a lot more work, you will have poorer support for Zwave over all, and you won’t have really gained anything except yet another little service you have to monitor and maintain.

2 Likes

I run my zwave stuff through zwave2mqtt. I did this because that zstick was a physical tie down of openhab to a specific system.

Since I moved to zwave2mqtt (which i run as a docker)

I have moved my entire openhab system in to my kubernetes environment. This allows my OH system to move around within the cluster without concern. If something happens with my zwave stick and i need to reset it, or unplug it to go add a new device. My OH system doesn’t get disconnected from it, it just doesn’t see any new mqtt messages until the zwave2mqtt starts posting again. In the past, if zwave acted up, i had to restart openhab, interrrupted everything.

I do agree with @rlkoshak that not everything HAS to be mqtt. I do like the ability of being able to decide what to push towards mqtt. I have plenty of other things that are not mqtt, but i chose to do the zwave2mqtt myself just so i can decouple that last physical piece that tied me to a single piece of hardware. Granted if my storage dumps out, i still have a single point of failure, but at the moment, i can patch and reboot any of my nodes and openhab will just happily move to another node no issues.

Hi there guys…

Even though I risc cutting off my nose to spite my face I decided to give zwave2mqtt a try. After all, I can always easily revert back if I change my mind or if it doesn’t work as expected. I’m actually currently running it as a docker container without any serious issues that I’m aware about. As it is now, openHAB doesn’t deal with any Z-wave devices at all. I have carefully selected which Z-Wave values are published to MQTT to avoid noise. All values are published as retained which kind of serves as persistence.
I can now stop openHAB without affecting openHAB and vice versa. Using zwave2mqtt is probably not something to be considered for everyone. I wish there were more detailed documentation and that there was a forum for it were users could share experience with each other.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.