Upgrade to 2.5.4 results in OH not reading mosquitto messages

  • Platform information:
    • Hardware: Raspberry Pi 3 Model B Rev 1.2_
  • OS: Raspbian GNU/Linux 8 (stretch)
  • OpenJDK Runtime Environment (Zulu 8.31.1.122-linux_aarch32hf) (build 1.8.0_181-b122)
  • openHAB Version: OH2.5.4 (apt-get), text-based config
    • binding = expire1,fritzboxtr0641,mqtt1,weather1,astro,exec,network,ntp,systeminfo,logreader
    • ui = paper,basic,classic,restdocs
    • persistence = rrd4j,mapdb
    • action = mail,mqtt
    • transformation = map,javascript,xslt,scale,jsonpath

I just did an apt-get update/upgrade, resulting in a bunch of errors.
I think I was on 2.4.0-something before the upgrade.

One error is that OH does not connect to the mosquitto broker on the same rPi.
The broker is working receiving messages, but OH does not pick these up.

No changes have been made to the config; all that was done was a apt-get update & upgrade.
My mgtt.cfg:

pid:org.openhab.mqtt
mymosquitto.url=tcp://localhost:1883
mymosquitto.clientId=openhab2
mymosquitto.retain=true

However, I noticed an error msg:

2020-04-21 18:03:39.169 [WARN ] [g.dispatch.internal.ConfigDispatcher] - The file /etc/openhab2/services/mqtt.cfg subsequently defines the exclusive PID 'org.openhab.mqtt'. Overriding existing configuration now.

I have no idea where the existing configuration is it is referring to.

[edit 1] Saved mqtt.cfg again (w/o making changes), and it created this error:

2020-04-21 19:19:54.369 [ERROR] [org.apache.felix.configadmin        ] - Cannot use configuration org.openhab.mqtt for [org.openhab.io.transport.mqtt.MqttService, org.osgi.service.cm.ManagedService, id=367, bundle=226/mvn:org.openhab.io/org.openhab.io.transport.mqtt/1.14.0]: No visibility to configuration bound to mvn:org.openhab.action/org.openhab.action.mqtt/1.14.0

[edit 2] found another file: mqtt.config

# [2020-04-21 19:30] maxg@rpi3ohv2 /var/lib/openhab2/config/org/openhab $ 
cat mqtt.config 
:org.apache.felix.configadmin.revision:=L"5"
mymosquitto.clientId="openhab2"
mymosquitto.retain="true"
mymosquitto.url="tcp://localhost:1883"
service.pid="org.openhab.mqtt"

deleted it; saved mqtt.cfg and the file reappeared.

Interestingly enough, I removed the PID form the mqtt.cfg, but it reappears in the mqtt.config.

[edit 3]
Checked the console, both mqtt action and binding are there:

213 │ Active │  80 │ 1.14.0                  │ openHAB Mqtt Action
219 │ Active │  80 │ 1.14.0                  │ openHAB MQTT Binding

You are using the version 1 binding of MQTT and the MQTT action. If I’m not mistaken there was a problem with those two. Deleting and reinstalling the mqtt action migth help.
Using the version 2 of mqtt would not need the action!

1 Like

What an idea :slight_smile:
I uninstalled the MqttAction via PaperUI, and the MQTT broker started:

2020-04-21 20:51:52.272 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2020-04-21 20:51:52.275 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mymosquitto'

Do I not need the MqttAction anymore?!
While it shows as not installed in PaperUI, it is still in the addon.cfg… weird. But it is gone from the addons.config.
Weird indeed.

If you are not using the MQTT action ( in a rule) you don’t need it.
Are checking by any chance the actual version of tasmota somehow? That would be a use-case.

I use the publish() method in some rules…

Well, I re-installed the MqttAction and restarted OH; this seems to have fixed this issue!

No idea what went on here; honestly don’t care, as it is working now!

Thank you @opus :slight_smile:

That was (for you is) a “known” but mysterious problem of the old mqtt binding.

1 Like

This is a long time well known bug with the MQTT Action that was never (and now never will) be fixed. You have to install the Binding before you install the Action or else it won’t work. As opus indicated, the MQTT 2 binding comes with the Action and does not require a separate add-on to be installed. In fact, all the old Action add-ons will not work with OH 3 when it’s released. Many of them have already been moved to bindings already and more are in work.

2 Likes

:slight_smile: Well known to frequent readers I reckon…

If I may ask: Specifically with MQTT; should I move to the v2 binding or install (I think there is) a moquette? or similar; which seems to be a native JAVA app; as I seem to recall, god knows how.)

Also, would it be best to get rid of all v1 bindings, actions? Is this possible to date?
(… if so, and I will do just that.)

If you have any desire to upgrade to OH 3 at any point in the future, you would be well advised to start moving to v2 bindings where available. It is possible to run both the v1 and v2 versions in parallel so you don’t have to do the conversion all at once.

I don’t know what bindings you are using so I can’t say whether or not it’s possible for you. I personally have moved to all 2.x version bindings, but it required coding a replacement for the Expire binding in Rules.

You will find in add-ons under the Misc tab “MQTT Broker Moquette”. Install it from PaperUI and that will install the embedded broker. Moquette would basically free you from needing to run Mosquitto or HiveMQ or what ever MQTT broker you are running now. It’s embedded and it’s an OH add-on so you install it like any other OH add-on.

But don’t worry about that. Just keep running the MQTT broker you are already running.

1 Like

I would recommend not to use openHABs internal broker but run Mosquitto instead.
There have been reports from other users about great delays with the internal broker.
MQTT 2.x binding works very well with Mosquitto.

3 Likes