I read the blog post on oh3 + mqtt here
I’m having problem to repeat the instructions and publish a message on/off switch message.
test1:
The blog demonstrates the publishing of the message via a third party utility MQTT Explorer that is “connected to our broker to see the messages”
I installed “MQTT Explorer” using the link that is provided in the blog, but I don’t know how to connect it to the broker.
I tried connecting it as follows:
Can somehone show how to connect “MQTT Explorer” to the broker?
test2:
I check that the mqtt broker connects/disconnects ok by doing:
OH3 -> Thing -> MQTT Broker -> Enable/Disable
The log file for mosquitto indeed shows the changes:
sudo tail -f /var/log/mosquitto/mosquitto.log
...
1618101031: New connection from 127.0.0.1 on port 1883.
1618101031: New client connected from 127.0.0.1 as 93f20a0a-05e5-437f-8c90-9d0ced74de18 (p2, c1, k60).
1618101056: Client 93f20a0a-05e5-437f-8c90-9d0ced74de18 disconnected.
But when I change the state of the switch
OH3 -> Items -> Test Switch 001 -> On/Off
The mosquitto log file does not show any change:
sudo tail -f /var/log/mosquitto/mosquitto.log
# Nothing is specified
I made sure that the MQTT broker Identifier (mqtt:broker:8ab964979f) is the one that is used in the rules, e.g.
actions.get("mqtt","mqtt:broker:8ab964979f").publishMQTT("testswitch001","ON")
I only have the MQTT binding.
Do I have to add e.g. ecmascript / Javascript binding?
The attached snapshots show:
- the setting for the MQTT Broker Thing