[SOLVED] MQTT Binding not working

I have the problem, that the MQTT Binding does not send the commands to the Mosquitto Server.
In the log files everything looks fine.

Here is a little test:

I tried to publish something to the MQTT Bus, but when I subscribed to that channel I received nothing.

Item config:

Switch Test_Switch "Test" {mqtt=">[mosquitto:ESP8266/connection_status:command:ON:on],>[mosquitto:ESP8266/connection_status:command:OFF:off]"}

mqtt.cfg:

#
# 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
mosquitto.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.
mosquitto.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.
mosquitto.user=openhab

# Optional. Password to authenticate with the broker.
mosquitto.pwd=xxxxxxxxxxx

# 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.
#<broker>.qos=<qos>

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

# 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>

OpenHAB Log:

2018-01-04 21:33:45.786 [DEBUG] [binding.mqtt.internal.MqttItemConfig] - Loaded MQTT config for item 'Test_Switch' : 0 subscribers, 2 publishers
2018-01-04 21:33:46.828 [DEBUG] [org.openhab.binding.mqtt            ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mqtt.MqttBindingProvider}={component.name=org.openhab.binding.mqtt.genericbindingprovider, component.id=244, service.id=376, service.bundleid=234, service.scope=bundle} - org.openhab.binding.mqtt
2018-01-04 21:33:46.870 [DEBUG] [ng.mqtt.internal.MqttEventBusBinding] - MQTT: Activating event bus binding.
2018-01-04 21:33:46.889 [DEBUG] [org.openhab.binding.mqtt            ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/*, service.pid=org.openhab.mqtt-eventbus, component.name=org.openhab.binding.mqtt.eventbus, component.id=245, service.id=379, service.bundleid=234, service.scope=bundle} - org.openhab.binding.mqtt
2018-01-04 21:33:46.898 [DEBUG] [org.openhab.binding.mqtt            ] - BundleEvent STARTED - org.openhab.binding.mqtt

I’m using the stable version of OpenHAB 2.2
What can I do?

1 Like

A reinstallation of the MQTT Action fixed the issue…

1 Like