Platform information:
- Hardware: Raspberry Pi 3B+ (rPi3B+)
- OS: Raspbian 8 (Jessie)
- Java Runtime Environment: Zulu Java Platform (OpenJDK 1.8.0_152)
- openHAB version: 2
Issue:
I have Mosquitto (broker and client) installed on the Raspberry that host openHAB 2 (as a package), MQTT binding installed and OH1.x compatibilty = true on the dashboard.
I have tested the MQTT broker with the following command:
service mosquitto status
ps -ef | grep mosq
netstat -tln | grep 1883
And it seems that everything is working cause the broker is on LISTEN on 1883 port.
In fact, as a Test, I have used MyMQTT from my phone (Android) to send the message āHi Rasp.ā on the topic ātest_1ā to the the MQTT Broker and responded with:
mosquitto_pub -d -t test_1 -m āHi Phone.ā
And everything works fine. I can read the message from the phone on the Raspberry and viceversa.
But I canāt communicate with openHAB.
I state that I have followed this tutorial: MQTT Binding (v1.11) Getting Started 101
Iāve tested the connection of the MQTT client to my Broker.
Iāve installed the MQTT Binding (binding-mqtt1) through Paper UI.
Iāve configured the binding setting in the file ā$OPENHAB_CONF/services/mqtt.cfgā this way:
pid:org.openhab.mqtt
oh2broker.url=tcp://localhost:1883
oh2broker.clientId=openhab2rpi3
oh2broker.user=openhabpi
oh2broker.pwd=password
And that work because checking the log I get:
MQTT Service initialization completed.
Starting MQTT Broker connection āoh2brokerā
Iāve define the ā$OPENHAB_CONF/items/test.itemsā as the tutorial told:
Switch MQTT_Test āTestingā¦ā { mqtt="<[oh2broker:testing/mqtt/topic:state:default], > [oh2broker:testing/mqtt/back-topic:command:*:default]" }
But unfortunately, when I publish MQTT Message with content āONā to Topic ātesting/mqtt/topic/ā from MyMQTT, I have an issue.
The openHAB log give me this message:
[WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldnāt post update for āMQTT_Testā
I tried to reinstall Mosquitto, reconfigure the broker, and use MQTTLens on Chrome as client but nothing to do.
Iāve changed oh2broker.url=tcp://localhost:1883 with oh2broker.url=tcp://192.168.1.254:1883 because the static IP of the raspberry is 192.168.1.254 but if I do that I only see
MQTT Service initialization completed.
Starting MQTT Broker connection āoh2brokerā
nothing else.