i am trying to publish from java client and able to receive the message from mqtt. but the value not reflecting on the web page. Where am wrong in it?
my java code
client = new MqttClient("tcp://91.121.251.24:1883", "rs_id");
client.connect();
client.subscribe("/webpage/status");
MqttMessage message = new MqttMessage();
Thread.sleep(1000);
message.setPayload("command:on".getBytes());
client.publish("/webpage/status", message);
client.disconnect();
items file
Switch webpage “Web Page Status” (all,mqtt) {mqtt=">[raffles:/webpage/status:command:ON:ON],>[mysensor:/testsw/1:command:OFF:ON]"}
String message “Log Status [%s]” {mqtt="<[raffles:/message/status:state:default]"}
Yann
(Yann)
March 13, 2017, 8:08am
2
I assume you configured the bindding file correctly.
You could use an MQTT client to test if something ist published:
http://www.mqttfx.org/
If this works but openHAB still does not, there are a lot of other threads with that problem:
Hi,
New Openhab2 user. Installed MQTT Binding 1.9 within PaperUI and received following message in event log:
[ExtensionEvent ] - Extension ‘binding-mqtt1’ has been installed
So all should be good on the install.
Here are my mqtt.cfg and items:
mosquitto.url=tcp://192.168.1.121:1883
Switch mySwitch “sonoff [%s]” {mqtt=">[mosquitto:cmnd/sonoffs/power:command:ON:1],>[mosquitto:cmnd/sonoffs/power:command:OFF:0]"}
I cannot see anything published in MQTTfx under # from this switch. …
psyciknz
(Psyciknz)
March 13, 2017, 8:23am
3
Hmm I thought I had this happening… I can see in the events log the mqtt messge being received, but it doesn’t reflect on the switch n the UI
There are zwave switches that can also talk MQTT? Or are you using MQTT messages to cause OH to send a command to a zwave device?
When debugging problems like this work backwards.
The UI isn’t upgrading so look to see the Item is being updated in events.log
Events.log is not showing updates so see if the message is being sent using mosquitto_sub or some other independent MQTT client.
If no MQTT messages are sent you need to debug the sender.
If you see the events at 1 you know OH is receivin…
i found the issue used the clientid both my java client and as well in openhab.cfg file.