Sonoff SNZB-01 Switches all started registering being pressed twice

  • Platform information:
    • Hardware: Virtualized, 4 cores, 4GB Ram
    • OS: Ubuntu 22.04.3 LTS
    • openHAB version: Started happening on OpenHAB 3 (OpenJDK 11), as well as continuing after upgrading to OpenHAB4 (OpenJDK 17)
  • Issue of the topic: I’m not sure exactly when, but a few months ago, my Sonoff SNZB-01 Switches all started doing the same thing, and that is pressing them (Single, Double, or Long press) will typically turn whatever I configured in it’s rules to turn on, but then it will never go off. I have my rules set that if light.state >= 1, then turn off, else if light.state <1, then turn on.

Thinking maybe it was an issue with openhab reading the value of the light (which is reporting correctly under the sitemap anyway), I even made some dummy switches that the rules control, based upon the input of the switch, and sometimes the switches will come on, but never go off (or toggle off for just a fraction of a second before coming back on again).

I can see via zigbee2MQTT that the switch is firing and detecting as single/double/long presses, and I have a rule that spits out in the openhab.log every time the switch is pushed, so I can see it’s triggering single/double/long presses, but the dummy switches will flick off and back on within a fraction of a second. Same goes for the lights, they’ll start to dim down to like 95% then go right back to 100%, and it’s been driving me crazy. I haven’t changed any of the rules between it working and then breaking.

My Ikea switches are not experiencing these issues, and they have the similar single/long press ability

  • Please post configurations (if applicable):
    • Items configuration related to the issue

mqtt.things:

    Thing topic bl_test_switch "Downstairs Office Test Switch" @ "Downstairs Office"
    {
        Channels:
            Type string : action "action" [ stateTopic = "zigbee2mqtt/BL_TestSwitch/action" ]
            Type number : voltage "voltage" [ stateTopic = "zigbee2mqtt/BL_TestSwitch/voltage" ]     
            Type number : battery "battery" [ stateTopic = "zigbee2mqtt/BL_TestSwitch/battery" ]     
            Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/BL_TestSwitch/linkquality" ]               
    }

sensors.items:

Switch    Switch_Dummy1
Switch    Switch_Dummy2
Switch    Switch_Dummy3

String     Switch_BL_TestSwitch                            "Test Switch [%s]"                    <button>     {channel="mqtt:topic:mosquitto:bl_test_switch:action"}
Number     Switch_BL_TestSwitchBatt                        "Test Switch Battery [%.0f %%]"       <battery>    {channel="mqtt:topic:mosquitto:bl_test_switch:battery"}

test.rules

rule "Test Switch Light Control"
when
    Item Switch_BL_TestSwitch received update
then

    switch(Switch_BL_TestSwitch.state.toString) {
        case "single": {
            logInfo("test.rules", "Test Switch fired single")

            if(Switch_Dummy1.state == ON){
                Switch_Dummy1.sendCommand(OFF)
            }

            else if(Switch_Dummy1.state == OFF){
                Switch_Dummy1.sendCommand(ON)
            }

        }
        case "double": {
            logInfo("test.rules", "Test Switch fired double")

            if(Switch_Dummy2.state == ON){
                Switch_Dummy2.sendCommand(OFF)
            }

            else if(Switch_Dummy2.state == OFF){
                Switch_Dummy2.sendCommand(ON)
            }

        }
        case "long": {
            logInfo("test.rules", "Test Switch fired long")

            if(Switch_Dummy1.state == ON || Switch_Dummy2.state == ON){
                Switch_Dummy1.sendCommand(OFF)
                Switch_Dummy2.sendCommand(OFF)
            }

            else if(Switch_Dummy1.state == OFF || Switch_Dummy2.state == OFF){
                Switch_Dummy1.sendCommand(ON)
                Switch_Dummy2.sendCommand(ON)
            }

        }
    }

end

My other rules are similar although instead of just checking the current dummy switch state, they check light levels

autolights_kitchen.rules

rule "Kitchen Counter Light Control"
when
    Item Switch_UL_NorthCounterSwitch received update
then

    //logInfo("autolights_kitchen.rules", "Kitchen Counter Lightswitch fired")
    switch(Switch_UL_NorthCounterSwitch.state.toString) {
        case "single": {
            
            if(Light_UL_Kitchen_CounterN_Dimmer.state >= 1){
                Light_UL_Kitchen_CounterN_Dimmer.sendCommand(OFF)
            }

            else if(Light_UL_Kitchen_CounterN_Dimmer.state < 1){
                Light_UL_Kitchen_CounterN_Dimmer.sendCommand(ON)
            }

        }
        case "double": {

            if(Light_UL_Kitchen_CounterW_Dimmer.state >= 1){
                Light_UL_Kitchen_CounterW_Dimmer.sendCommand(OFF)
            }

            else if(Light_UL_Kitchen_CounterW_Dimmer.state < 1){
                Light_UL_Kitchen_CounterW_Dimmer.sendCommand(ON)
            }

        }
        case "long": {

            if(Light_UL_Kitchen_CounterN_Dimmer.state >= 1 || Light_UL_Kitchen_CounterW_Dimmer.state >= 1){
                Light_UL_Kitchen_CounterN_Dimmer.sendCommand(OFF)
                Light_UL_Kitchen_CounterW_Dimmer.sendCommand(OFF)
            }

            else if(Light_UL_Kitchen_CounterN_Dimmer.state < 1 || Light_UL_Kitchen_CounterW_Dimmer.state < 1){
                Light_UL_Kitchen_CounterN_Dimmer.sendCommand(ON)
                Light_UL_Kitchen_CounterW_Dimmer.sendCommand(ON)
            }

        }
    }

end

And it’s worked fine for well over a year so I’m not sure what happened, nor why every one of my Sonoff SNZB-01 Switches are exhibiting the same issue.

The only thing I can see is the switch logs (in openhab) are reporting as if they have received the command twice:

single tap (registered twice):
2023-09-15 08:03:57.070 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired single
2023-09-15 08:03:57.071 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired single

single tap (registered twice):
2023-09-15 08:04:01.400 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired single
2023-09-15 08:04:01.402 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired single

double tap (registered twice):
2023-09-15 08:04:04.948 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired double
2023-09-15 08:04:04.951 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired double

single tap (registered twice):
2023-09-15 08:04:25.205 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired single
2023-09-15 08:04:25.208 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired single

double tap (registered twice):
2023-09-15 08:04:40.639 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired double
2023-09-15 08:04:40.641 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired double

long press (registered once correctly):
2023-09-15 08:04:53.176 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired long

long press again (registered twice):
2023-09-15 08:05:08.110 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired long
2023-09-15 08:05:08.117 [INFO ] [openhab.core.model.script.test.rules] - Test Switch fired long

Any suggestions? I tried searching the community but not even sure what the issue is or why this suddenly started happening in June.

Further investigation shows via zigbee2MQTT shows in it’s logs that it’s detecting double press too

info 2023-09-15 08:14:49MQTT publish: topic 'zigbee2mqtt/BL_TestSwitch', payload '{"action":"single","battery":100,"linkquality":72,"voltage":3000}'
info 2023-09-15 08:14:49MQTT publish: topic 'zigbee2mqtt/BL_TestSwitch/voltage', payload '3000'
info 2023-09-15 08:14:49MQTT publish: topic 'zigbee2mqtt/BL_TestSwitch/battery', payload '100'
info 2023-09-15 08:14:49MQTT publish: topic 'zigbee2mqtt/BL_TestSwitch/linkquality', payload '72'
info 2023-09-15 08:14:49MQTT publish: topic 'zigbee2mqtt/BL_TestSwitch/action', payload 'single'
info 2023-09-15 08:14:49MQTT publish: topic 'zigbee2mqtt/BL_TestSwitch', payload '{"action":"single","battery":100,"linkquality":69,"voltage":3000}'
info 2023-09-15 08:14:49MQTT publish: topic 'zigbee2mqtt/BL_TestSwitch/voltage', payload '3000'
info 2023-09-15 08:14:49MQTT publish: topic 'zigbee2mqtt/BL_TestSwitch/battery', payload '100'
info 2023-09-15 08:14:49MQTT publish: topic 'zigbee2mqtt/BL_TestSwitch/linkquality', payload '69'
info 2023-09-15 08:14:49MQTT publish: topic 'zigbee2mqtt/BL_TestSwitch/action', payload 'single'

I wonder if a few months ago it updated them all with a bugged update, I’m open to suggestions before I rip them all out and swap them with the ikea toggle switches instead.