How can I make MQTT more reliable

Tl;dr at the bottom.

Hi, I have the following setup:

I have two sorts of lights, one is from Busch Jaeger and controlled by this binding through OpenHAB on a Raspberry Pi, and the other ones are from OSRAM.

My goal is, that I can switch on one of the lights and the other ones get switched on as well.

Since the OSRAM lights are not supported by OpenHAB, I installed Home-Assistant on another Raspberry Pi and control them from there.

I connected the two systems via MQTT, using Mosquitto as a broker which is set up using openhabian-config on the OpenHAB-Raspberry Pi.

I then created corresponding switches in OpenHAB and Home-Assistant using this guide which works.

I then created some rules on the OpenHAB and Home-Assistant setup that links the created and actual switches in each instance, so that when I turn on the Busch Jaeger lights it goes the following: Wall switch > Busch Jaeger > Representation of the lights on OpenHAB > created switches in OpenHAB > MQTT > created switches in Home-Assistant > actual switches in Home-Assistant > OSRAM lights are switched on.

This all, despite being complicated, works without a problem and as intended.
My only problem is that MQTT only works half of the time. The other time it just doesn’t trigger the switch in the other setup and I don’t know why.

Is there any way to make MQTT more reliable, so that it “fires” every time, or do you have a completely different solution for this setup? It actually works really well so I don’t really want to change it, but if it is impossible to make MQTT more reliable, I don’t mind setting this up differently.

Just FYI, this is set up on two completely new Raspberry Pis so I can scrape the whole things if necessary and nothing is lost.

Tl;dr MQTT only works half of the time, why?

Well, MQTT and openHAB all by themselves ARE reliable.
If it only works half of the time I suspect it’s due to misconfiguration or the way you have integrated Home Assistant. Can’t tell from your description. I suggest you enable MQTT debugging in OH to find out (log:set debug org.openhab.binding.mqtt in Karaf console).
Overall, to have two systems (OH & HA) run in parallel and both to take control is no good idea. They will likely interfere with each other in one way or another.
Osram Lightify lights are supposed to work with openHAB, either using a raspbee or Hue bridge, and possibly using the ZigBee binding, too.

1 Like

If you enable the marketplace in Configuration -> System (paperUI) you’ll find there is a binding for OSRAM Lightify/SMART+ gateways. No need to make things more complicated than they need to be.

Oh, didn’t know that, that worked thanks!

Thanks for your reply. I double checked the configuration and it should be correct. I looked at what OpenHAB was sending to mosquitto and according to the logs OpenHAB just stopped sending data, so I don’t know what was happening there, but I just used the marketplace binding mentioned by @mjagdis which works, so I will stick with that. Thanks anyways!