[SOLVED] MQTT action doesn't publish although there is no logged exception

mqtt
mqtt-action
Tags: #<Tag:0x00007f51db07b078> #<Tag:0x00007f51db07aee8>

(Oliver Libutzki) #1

Hi evryone,

I use the MQTT event-bus to expose states and commands to the local MQTT broker (Mosquitto). This works pretty well, so oviously the connection between OH2 and Mosquitto works.

Unfortunately I cannot publish a message by using the MQTT action. I do not see any error, but the clients which subscribe on a topic which I publish with the MQTT action are not notified.

In the openhab log I can see this log entry:

20:16:05.126 [DEBUG] [org.openhab.action.mqtt.internal.Mqtt] - Message to broker: mqtt, topic: playground/test

This is the code of my rule:

publish("mqtt", "playground/test", "")

Everything seems to be working… but unfortunately it just seems to…

Any ideas? Thanks!

Kind regards
Oliver


(Oliver Libutzki) #2

Obviously the message is not passed to the MqttBrokerConnection. After setting the log level of org.openhab.io.transport.mqtt to DEBUG I do not see any message like

Publishing message 50156 to topic 'playground/test'

(Rich Koshak) #3

First the basics.

  1. You’ve installed the MQTT Action?
  2. You’ve installed the MQTT Binding? (I think the Action requires the binding).
  3. The mqtt.cfg has a configuration for the broker “mqtt”?
  4. Does it publish if you pass a non-empty message? Perhaps there is a check that keeps it from sending empty messages.

(Oliver Libutzki) #4
  1. yes
  2. yes
  3. yes, content below
  4. No
#
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.
#

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
#<broker>.url=tcp://<host>:1883
mqtt.url=tcp://localhost:1883

# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
#<broker>.clientId=<clientId>
mqtt.clientId=openhab

# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false

# Optional. User id to authenticate with the broker.
mqtt.user=openhabian

# Optional. Password to authenticate with the broker.
mqtt.pwd=<secret>

# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
mqtt.qos=1

# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
mqtt.retain=true

# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
#<broker>.async=<async>

# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
#<broker>.lwt=<last will definition>

(Vincent Regaud) #5

There is a problem with the mqtt action that occur sometimes. Remove the action, clear the cache and after a restarting oh, install the action agian


(Oliver Libutzki) #6

Thanks! That fixed it!


(Vincent Regaud) #7

Coolio! Please mark the thread as solved. Thanks


(Oliver Libutzki) #8

Done


(Kris K) #9

Hi All

Not sure if this is a similiar issue, but my MQTT is broken all of a sudden

I see this:


[ng.mqtt.internal.MqttMessagePublisher] - Unable to publish. No senderChannel exists.

The bindings are all installed and nothing has changed from that perspective. Ill turn debug on to see wahts going on. The actual sonoff unit is working just fine. Events and openhab log show no issues.


kris@openhab2:/etc/openhab2/rules$ systemctl status mosquitto
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
   Loaded: loaded (/etc/init.d/mosquitto; generated)
   Active: active (exited) since Tue 2019-02-12 06:24:00 AEDT; 1h 54min ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/mosquitto.service

Feb 12 06:24:00 openhab2 systemd[1]: Starting LSB: mosquitto MQTT v3.1 message broker...
Feb 12 06:24:00 openhab2 mosquitto[18570]:  * Starting network daemon: mosquitto
Feb 12 06:24:00 openhab2 mosquitto[18570]:    ...done.
Feb 12 06:24:00 openhab2 systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.
kris@openhab2:/etc/openhab2/rules$