Switch Item is not publishing any value over mqtt

I have have installed matt binding using paper ui, I have installed openhab2 on rasberry pi configured Switch item as following:-
Switch mySwitch “mySwitch” {mqtt=">[mosquitto:/office/light:command:OFF:0],>[mosquitto:/office/light:command:ON:1]", autoupdate="false}

my mqtt broker is running on other linux machine (Not Rasberry Pi).
My mqtt.cfg is like:-
mosquitto.url=tcp://192.168.29.4:1883
mosquitto.qos=0
mosquitto.retain=false

here 192.168.29.4 is ip of machine where mqtt broker is running.

I have installed MQTT.fx and subscribe to topic /office/light but noting is shown

I have also check openhab logs it shows me:-

  • Loaded MQTT config for item ‘mySwitch’ : 0 subscribers, 2 publishers
    nothing after that
    please help

Your topic starts with a “/”, try without.

Switch mySwitch “mySwitch” {mqtt=">[mosquitto:office/light:command:OFF:0],>[mosquitto:office/light:command:ON:1]", autoupdate="false}

I have tried it but nothing working

Did you solve this? I have the same problem

Here a few suggestions:

  • check that you have both the binding and the action installed
  • check your error log for any MQTT related messages
  • check your event.log and make sure that an event actually occurred for this item
  • in MQTT.fx set the scan option to scan for any MQTT activities to make sure that you are not missing a channel due to a misplaced / or a typo
  • re-install MQTT binding and action (you need both), not sure if this is still an issue, but a while ago the binding turns unresponsive for me, un-installing and re-installing both the binding AND the action was the only remedy I could find

Can you show the mqtt part of the log when openHAB starts up, please?
Set your MQTT.fx to subscribe to # and see what traffic there is