Openhab not sending command to mqtt after upgrade 2.1

Hi there, I’m back again :frowning:
After my upgrade to openhab 2.1 my sonoff s20 switches stopped working.

I’ve been looking for the past 2 hours and giving up for tonight, did anything change regarding this?

What I have debugged so far:

When subbing to ‘#’ with mosquitto_sub, I see the device I’m looking for:

plug/tvswitch/LWT Online
plug/tvswitch/power ON
plug/tvswitch/POWER ON
plug/tvswitch/cmnd/POWER OFF

When logging from mosquitto,and manually switching the sonoff S20 (with the webinterface) I see the updates coming in:

plug/tvswitch/RESULT {"POWER":"ON"}
plug/tvswitch/POWER ON
plug/tvswitch/RESULT {"POWER":"OFF"}
plug/tvswitch/POWER OFF

-v log from mosquitto:

1499288796: mosquitto version 1.4.12 (build date Thu, 25 May 2017 22:38:16 +0100) starting
1499288796: Using default config.
1499288796: Opening ipv4 listen socket on port 1883.
1499288796: Opening ipv6 listen socket on port 1883.
1499288807: New connection from on port 1883.
1499288807: New client connected from as TVSwitch (c1, k15, u'DVES_USER').
1499288807: Sending CONNACK to TVSwitch (0, 0)
1499288807: Received PUBLISH from TVSwitch (d0, q0, r1, m0, 'plug/tvswitch/LWT', ... (6 bytes))
1499288807: Received PUBLISH from TVSwitch (d0, q0, r0, m0, 'plug/tvswitch/cmnd/POWER', ... (0 bytes))
1499288807: Received SUBSCRIBE from TVSwitch
1499288807:     plug/tvswitch/cmnd/# (QoS 0)
1499288807: TVSwitch 0 plug/tvswitch/cmnd/#
1499288807: Sending SUBACK to TVSwitch
1499288807: Received SUBSCRIBE from TVSwitch
1499288807:     plug/sonoffs/cmnd/# (QoS 0)
1499288807: TVSwitch 0 plug/sonoffs/cmnd/#
1499288807: Sending SUBACK to TVSwitch
1499288807: Received SUBSCRIBE from TVSwitch
1499288807:     plug/TVSwitch/cmnd/# (QoS 0)
1499288807: TVSwitch 0 plug/TVSwitch/cmnd/#
1499288807: Sending SUBACK to TVSwitch

But the switch in my app is not updating anymore, also the basicui it’s not working, I can use the switch but no updates are getting to my musquitto

my items file:

Switch TVSwitch "Tv Stopcontact" <poweroutlet> (LR,gLight){ mqtt=">[mymqtt:plug/tvswitch/cmnd/POWER:command:*:default],<[mymqtt:plug/tvswitch/POWER:state:default]" }

When I try to use the switch from openhab basic UI and app I do see these lines in my events.log, but nothing happening on mosquitto side:

2017-07-05 23:14:48.223 [ItemCommandEvent          ] - Item 'TVSwitch' received command ON
2017-07-05 23:14:48.234 [ItemStateChangedEvent     ] - TVSwitch changed from OFF to ON
2017-07-05 23:14:48.861 [ItemCommandEvent          ] - Item 'TVSwitch' received command OFF
2017-07-05 23:14:48.870 [ItemStateChangedEvent     ] - TVSwitch changed from ON to OFF

Can anyone see something missing? I rebooted as well, and restarted mosquitto. I also tried to remove broker from userdata/mosquitto.conf (there where 2 in the file, I’m using the mymqtt)

What do you see in openhab.log? In particular are there any errors? Do you see the connecting to the broker log message when OH first starts?

I’ve also lost something when upgrading to 2.1.0 with MQTT. I used to send commends to my roller shutter through Mosquitto (coming from Nodered) and now, these commands are just ignored… nothing happens.

I did not troubleshot as you did for now, will try to dig into my logs.

I just checked the openhab log:

 MQTT Service initialization completed.
2017-07-05 22:43:02.237 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mymqtt'
2017-07-05 22:43:02.858 [ERROR] [] - Error starting broker connection

OK, the problem is that OH is failing to connect to the broker.

Do you see anything in the broker’s logs that might indicate whether OH is ever reaching it and if so why the login is being rejected?

Look in userdata/config/org/openhab/mqtt.config (that is /var/lib/openhab/config/org/mqtt.config if apt-get installed) and compare it to conf/services/mqtt.cfg (that is /etc/openhab2/services/mqtt.cfg for apt-get installed). In particular, when things are deleted from the cfg, the one in user data does not remove the old entries.

If they are different, stop openhab, delete the one in userdata and try again.

Also, are you running the mqtt actions binding? That was giving me issues when I tried to setup my installation last week.

1 Like

That was the problem for me, too! As soon as I uninstalled the MQTT-Action, my MQTT commands started working again (only status worked up until now)

Thanks for all the thoughts, I checked the configs, they were identical, I then decided to uninstall the mqtt binding, and re-install through the PaperUI, and it started working again :stuck_out_tongue: :thinking: I have no idea what caused the issue, it happened right after the upgrade to 2.1

Thanks to all for the information. For me it was the uninstall/reinstall of the action. The uninstall/reinstall of the binding did not have an effect (positive or negative).

same here problem solved when uninstall MQTT-Action :sweat_smile:
I also experience a problem of receiving duplicate commands to my device when i using paper UI in openhab2. Problem gone when it upgraded to 2.1