MQTT switch not working

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.

When using MQTTfx to publish to my pine64 as mqtt broker it works fine and my lights turn on/off.

I’ve tried reinstalling, checking my config files for multiple entries of the mqtt.cfg changes, trying multiple things in the .items file aswell(such as changing inbound/outbound).

Anyone have a solution to why there is no published MQTT from this setup?

Try changing the name from mosquitto. I used this orginally and then had changed it as it stopped working.

One of my items

Switch DO_70_1 “Towel Rail Overide[%s]” (Bathroom,Node70,log) {mqtt=">[OH2MQTT:home/rfm_gw/sb/node70/dev16:command:ON:ON],>[OH2MQTT:home/rfm_gw/sb/node70/dev16:command:OFF:OFF]",autoupdate=“true”}

my mqtt.cfg

OH2MQTT.url=tcp://192.168.1.10:1883

I tried switching it from mosquitto to mqqt.broker to openhab to OH2 and so on. I also purged the mqtt.cfg for multiple entries.

Still nothing, thanks for sharing your items I will see if that setup works for some reason.

Try removing the old.config file. In my setup they are stored at

var\lib\openhab2\config\org\openhab

suggest deleting mqtt.config

Hey ,

I have a similar problem with my mqtt binding. I wanted to create a new topic, but I think this one is the same. I had it running and had every config file backuped. Yesterday I installed openhabian and with it’s config mosquitto. Then I copied the backup to the new system. Now it’s not working.

The Broker is working. The energyplug sends updates to my PC-client.

I tried changing the name like it was suggested, but it did not work.

Could someone look at my code? I’m probably missing the obvious…

mqtt.cfg

openbroker.url=tcp://localhost:1883
openbroker.clientId=openHAB

mqtt.items

Switch Steckdose  "Die Steckdose ist " {mqtt="<[openbroker:stat/sonoff/POWER:state:default],>[openbroker:cmnd/sonoff/power:command:*:default]"}

default.sitemap

Switch item=Steckdose

This is what the logfile gives me when I press the switch

2017-03-02 20:55:11.640 [ItemCommandEvent          ] - Item 'Steckdose' received command OFF
2017-03-02 20:55:11.649 [ItemStateChangedEvent     ] - Steckdose changed from ON to OFF
2017-03-02 20:55:12.617 [ItemCommandEvent          ] - Item 'Steckdose' received command ON
2017-03-02 20:55:12.626 [ItemStateChangedEvent     ] - Steckdose changed from OFF to ON

try Switch Steckdose “Die Steckdose ist " {mqtt=”<[openbroker:stat/sonoff/POWER:state:default],>[openbroker:cmnd/sonoff/power:command::command:ON:ON,>[openbroker:cmnd/sonoff/power:command::command:OFF:OFF]"}

I am still having issues with my OpenHAB MQTT Client publishing any messages at all.

I have tried as you suggested and i tried reinstalling all the .CFG files as well.

I copied your suggested items and names directly with no luck.

No published MQTT messages logged in my MQTT.fx logs when attempting to use the switch. I can still publish messages from my MQTT Dash phone app and MQTT.fx computer program and communicate with the broker.

Any information I can give which would help find the problem?

Can you subscribe to any topics via Openhab (e.g. see items published to from your MQTT Dash phone)? I’m assuming that you have installed mosquitto? if not see http://www.homeautomationforgeeks.com/project/mosquitto.shtml