How to locate a mqtt action remnant in snapshot 2.2, build 1050

Tags: #<Tag:0x00007fc3e95b3a60> #<Tag:0x00007fc3e95b3970> #<Tag:0x00007fc3e95b38a8>

I upgraded to snapshot 2.2 and I ended up having to uninstall and reinstall the bindings. I still could not fire off the mqtt commands so I uninstalled the mqtt action. Then the mqtt commands started to work. I reinstalled mqtt action but I noticed that on one mqtt command where I use Telegram for notification, I started to receive two notifications. Today I had a power outage and once again my mqtt commands stopped working. I rebooted the openhab server and the mqtt commands did not work. I verified through Alexa that I could control those devices. So I uninstalled mqtt action and they started working again and the number of notifications for that one mqtt device is down to one.

Is mqtt action required to be added? How to check if there is remnant from the 2.1 build in the system.

No, it is not required. And there is a known problem where the MQTT Action will break the MQTT Binding when both are installed but usually, the permanent fix is to uninstall and reinstall the Action. You are seeing slightly different behavior so I’m not certain you are seeing the same problem.

But if you are not using the publish action in your rules anywhere, you can safely remove the Action. And even if you are using publish, you can replace those with a String Item bound to the MQTT topic and sendCommand to that Item instead of using publish.

Log into the karaf console and run the command:

bundle:list | grep MQTT

The fourth column is the version number of the binding and the second column is whether or not the binding is Active. If you do not have the MQTT Action installed you should see only two, a Binding and a Transport Bundle and they should both be the same version.

Question, have you ever modified the mqtt.cfg and changed the name of the broker?

Rich, thanks for taking the time to reply. Yes, I’m using the publish action in some of my rules. The rule with duplicate telegram notification is not using a publish action. The item is a mqtt command and the rule notifies me when the garage door is opened and closed. I took a look and verified that the publish action is not installed as shown below. So far the publish actions are working even after a reboot.

openhab> bundle:list | grep MQTT
186 │ Resolved │ 80 │ 1.11.0.201709280110 │ openHAB MQTT Binding
197 │ Resolved │ 80 │ 1.11.0.201709280110 │ openHAB MQTT Transport Bundle

So how do I go about converting publish action to a sendcommand? Here is one publish action I have in my rules.

publish(“mosquitto”,“cmnd/whitelamp/POWER”,“OFF”)

New Item:

String WhiteLamp { mqtt=">[mosquitto:cmnd/whitelamp/POWER:command:*:${state}]" }

In rule:

WhiteLamp.sendCommand("OFF")

This is generic and works great for arbitrary messages. However, in this case you are sending Switch commands so:

Switch WhiteLamp {mqtt=">[mosquitto:cmnd/whitelamp/POWER:command:ON:ON],>[mosquitto:cmd/whitelamp/POWER:command:OFF:OFF]"}

And in the rule:

WhiteLamp.sendCommand(OFF)

Thanks Rich. I applied the changes and the sendCommand works. I’m planning to install rollorshutters that interface with mqtt. It appears that I can still use the sendCommand but I wonder if you can share an example of point to a post that I can reference.

There are tons of rollershutter posts but I don’t have any personally so I can’t think of any particularly good ones for you off the to of my head.

Do a search of the forum and I’m sure you’ll find something useful.