Sonoff MQTT issues

  • Platform information:
    • Hardware: ODoid

    • OS: Ubuntu 16.04.7 LTS

    • Java Runtime Environment: OpenJDK Runtime Environment (build 1.8.0_275-8u275-b01-0ubuntu1~16.04-b01)

    • openHAB version: 2.5.10-1

  • Issue of the topic: Openhab not switching Sonoff lights on/off

I’ve got 3 sonoff lights setup which I last used last Christmas. After Christmas I renamed the rules/items to .old and haven’t used them since. I’ve now configured them again and also updated to version 2.5.10-1. I think previously I was on 2.4

I’ve got a rule where when the XmasGarage light is turned on, it then triggers and turns on XmasKitchen and XmasLounge. All of this was working a year ago.

The problem now is I can see OH2 trying to turn on the lights but none of them switch on.

If I browse to sonoff-garage, sonoff-kitchen, sonoff-lounge I can manually switch the lights on so the devices are on the network and working (Can also ping them from OH2)


Switch XmasGarage "Christmas Lights" <light> (LR,gLight) ["Lighting"]
    { mqtt=">[mosquitto:cmnd/sonoff-garage.home/POWER:command:*:default],
            <[mosquitto:stat/sonoff-garage.home/POWER:state:default]" }

Switch XmasLounge "Lounge Xmas" <light> (LR,gLight) ["Lighting"]
    { mqtt=">[mosquitto:cmnd/sonoff-lounge.home/POWER:command:*:default],
            <[mosquitto:stat/sonoff-lounge.home/POWER:state:default]" }

Switch XmasKitchen "Kitchen Xmas" <light> (LR,gLight) ["Lighting"]
    { mqtt=">[mosquitto:cmnd/sonoff-kitchen.home/POWER:command:*:default],
            <[mosquitto:stat/sonoff-kitchen.home/POWER:state:default]" }




rule "Turn on garage xmas lights"
        Item XmasGarage changed from OFF to ON
        sendCommand(XmasLounge, ON)
	sendCommand(XmasKitchen, ON)

rule "Turn off garage xmas lights"
        Item XmasGarage changed from ON to OFF
        sendCommand(XmasLounge, OFF)
	sendCommand(XmasKitchen, OFF)


2020-12-05 16:33:36.193 [ome.event.ItemCommandEvent] - Item 'XmasGarage' received command ON

2020-12-05 16:33:36.198 [vent.ItemStateChangedEvent] - XmasGarage changed from OFF to ON

2020-12-05 16:33:36.202 [ome.event.ItemCommandEvent] - Item 'XmasLounge' received command ON

2020-12-05 16:33:36.205 [ome.event.ItemCommandEvent] - Item 'XmasKitchen' received command ON

Any help would be appreciated. I’ve tried removing the tmp and cache directories and rebooted a few times.

Been trying to get this going for hours and out of ideas :frowning:
I don’t think its a mqtt service issue as I have a few temperature sensors on the network which are using mqtt and sending updated data to OH2

Stab in the dark: try this format


No luck. Didnt have any effect.

Uses logInfo line in order to Check if either rule is started at all.

Do you have mosquitto installed?

Yes, I’m using mosquitto and have it working for temperature sensors sending data to OH.

The rule is being started. I have since changed the item to do a HTTP get to the Sonoff and that works 100%. So its something with the mqtt for the Sonoff’s.

Did you check settings on the Sonoffs to make sure they are still configured with the right MQTT topics?

Just re-checked them. One of the the sonoff’s had the incorrect setting on the topic, but the other 2 were correct. Corrected it, but unfortunately still no go.

Going to try upgrade the firmware on one of the sonoffs. Maybe something weird going on there. Firmware is a few years old so maybe some compatibility issue.