MQTT Updates not working anymore with OH 2.2

I set up some items, which get updated via MQTT

Number Sensoren_SonoffDryer_Power 	"Trockner Verbrauch [%.1f W]" 	(gOutletsUG, UG_Waschen)   { mqtt="<[mqttoh2:tele/sonoffDryer/ENERGY:state:JSONPATH($.Power)]" }
Number Sensoren_SonoffDryer_Current 	"Trockner Ampere [%.1f A]" 	(gOutletsUG, UG_Waschen)   { mqtt="<[mqttoh2:tele/sonoffDryer/ENERGY:state:JSONPATH($.Current)]" }

This worked with OH2.1, but stopped today after upgrading to 2.2

I do not only have the MQTT-Binding working, but also the MQTT-Eventbus. The Eventbus works fine and I can update via the bus without problems. But neither the Sonoff-POWs, nor if I send MQTT-Messages tele/sonoffDryer/ENERGY manually, the items get updated. Using my Eventbus logic openHAB/slave/${item}/state works.

Isn’t it possible anymore to use both methods in parallel?

mqtt.cfg

mqttoh2.url=tcp://192.168.x.x:yyy
mqttoh2.clientId=CLIENTID
mqttoh2.user=USER
mqttoh2.pwd=PASSWORD
mqttoh2.qos=1

mqtt-eventbus.cfg

broker=mqttoh2
# statePublishTopic=openHAB/master/${item}/state
# commandPublishTopic=openHAB/slave/${item}/command
stateSubscribeTopic=openHAB/slave/${item}/state
# commandSubscribeTopic=

There have been a few people with problems with mqtt, have you tried uninstalling then reinstalling the binding? This has worked for most.

Sorry, didn’t work out… Same procedure as before:

  • MQTT-Eventbus working
  • MQTT-Itemupdate (via different Topic) not working

Seems like you can’t use both anymore…? I could update a Proxy-item with the Sonoff-JSON via Eventbus Topic and then updating the items via a rule… but this really isn’t the solution… :thinking:

What’s strange:
items get updated to the MQTT-Broker, but incoming MQTT-messages won’t change the value.

Switch Sensoren_Status_SonoffDryer "Trockner Status" { mqtt=">[mqttoh2:cmnd/sonoffDryer/power:command:*:default],<[mqttoh2:stat/sonoffDryer/POWER:state:default]" }

This one switches the Dryer’s Sonoff POW ON and OFF. But again - if I Switch the Sonoff via Sonoff’s GUI or at the Switch, the message gets send, but OH2 doesn’t receive it.

I am having the same issue too. Looking at the mqtt broker logs i don’t see any connections coming from the openhab server. So its not actually subscribing to the broker.
I have also tried uninstalling and then reinstalling the mqtt binding. Any help here would be greatly appreciated!

1 Like

So it seems i posted here too soon, after some googling i found this thread:

After uninstalling and reinstalling MQTT Action (not only MQTT binding) it’s now working again.

Hope this helps you?

1 Like

hmmm. i don’t even have MQTT Action installed…?

Just did:

  1. installed mqtt-action
  2. reinstalled mqtt-action and mqtt1-binding

=> still nothing worked

  1. stopped OH2-service
  2. sudo apt-get install --reinstall openhab2
  3. cleared cache and tmp (which were already cleared), but also config and jsondb
  4. started OH2-sevice

=> still no incoming MQTT-items…

strange thing: If installed MQTT1-binding on my DEV-Pi (new openHABian, freshly installed) both ways work.
as my productive Pi not only has openhab on it, but also some 3rd party tools I need to run for my environment, I’m reluctant to completely ditch my OH2 and replace it with a fresh install…

Have a look at your corresponding mqtt.config in /userdata/config/org/openhab, if it has different data than your mqtt.cfg, stop openHAB, delete mqtt.config and restart.

It’s the same. Which is no surprise, because both mqttEventbus as updating items from my OH2 to the broker works.
What doesn’t work is incoming changes like I described above:

Switch Sensoren_Status_SonoffDryer "Trockner Status" { mqtt=">[mqttoh2:cmnd/sonoffDryer/power:command:*:default],<[mqttoh2:stat/sonoffDryer/POWER:state:default]" }

first one works (the Sonoff gets the messages), second one not (OH2 doesn’t get updates).

What does work:

  • mqttEventbus with another Pi (both ways)
  • mqtt-Updates with eventbus-like Topics (I use this one instead of REST-API)

I just reinstalled the whole thing (after apt-get purge and apt-get install didn’t work out).
Took me a while, because halfway through I destroyed my raspbian…

but now, I have a clean fresh installation of openHABian including working MQTT in both ways.