Openhab and Sonoff Switch

I am trying to figure out why your Power1 switch reacts the way you see.
Please open the console of the sonoff device ( you called it the tasmota webpage).
Insert “SwitchMode1” and “SwitchMode2” on the console
and report the results.

21:13:43 CMD: SwitchMode1
21:13:43 MQT: stat/sonoffSERCAM/RESULT = {“SwitchMode1”:0}
21:14:17 CMD: SwitchMode2
21:14:17 MQT: stat/sonoffSERCAM/RESULT = {“SwitchMode2”:0}

So that was not it!
Second try, this time there will be more information,
Please try “Status1 0” and “Status2 0”

I’m trying to find the setting which is set to the switch 1 but not switch 2!

21:26:33 CMD: Status1 0
21:26:33 MQT: stat/sonoffSERCAM/STATUS = {“Status”:{“Module”:39,“FriendlyName”:[“Sonoff”,“Sonoff2”],“Topic”:“sonoffSERCAM”,“ButtonTopic”:“0”,“Power”:0,“PowerOnState”:3,“LedState”:1,“SaveData”:1,“SaveState”:1,“SwitchTopic”:“0”,“SwitchMode”:[0,0,0,0,0,0,0,0],“ButtonRetain”:0,“SwitchRetain”:0,“SensorRetain”:0,“PowerRetain”:0}}
21:26:33 MQT: stat/sonoffSERCAM/STATUS1 = {“StatusPRM”:{“Baudrate”:115200,“GroupTopic”:“sonoffs”,“OtaUrl”:“http://thehackbox.org/tasmota/release/sonoff.bin",“RestartReason”:"Software/System restart”,“Uptime”:“0T00:15:09”,“StartupUTC”:“2019-03-14T20:11:24”,“Sleep”:50,“CfgHolder”:4617,“BootCount”:4,“SaveCount”:48,“SaveAddress”:“F4000”}}
21:26:33 MQT: stat/sonoffSERCAM/STATUS2 = {“StatusFWR”:{“Version”:“6.4.1.19(sonoff)”,“BuildDateTime”:“2019-03-14T21:16:01”,“Boot”:31,“Core”:“2_5_0”,“SDK”:“3.0.0-dev(c0f7b44)”}}
21:26:33 MQT: stat/sonoffSERCAM/STATUS3 = {“StatusLOG”:{“SerialLog”:2,“WebLog”:2,“SysLog”:0,“LogHost”:"",“LogPort”:514,“SSId”:[“TP-LINK_88A51C”,""],“TelePeriod”:300,“Resolution”:“558180C0”,“SetOption”:[“00008009”,“280500000100000000000000000000000000”,“00000000”]}}
21:26:33 MQT: stat/sonoffSERCAM/STATUS4 = {“StatusMEM”:{“ProgramSize”:587,“Free”:416,“Heap”:18,“ProgramFlashSize”:1024,“FlashSize”:1024,“FlashChipId”:“144051”,“FlashMode”:3,“Features”:[“00000809”,“0FDAE794”,“000783A0”,“23B617CE”,“00003BC0”]}}
21:26:33 MQT: stat/sonoffSERCAM/STATUS5 = {“StatusNET”:{“Hostname”:“sonoffSERCAM-2325”,“IPAddress”:“192.168.0.107”,“Gateway”:“192.168.0.1”,“Subnetmask”:“255.255.255.0”,“DNSServer”:“192.168.0.1”,“Mac”:“DC:4F:22:97:69:15”,“Webserver”:2,“WifiConfig”:4}}
21:26:33 MQT: stat/sonoffSERCAM/STATUS6 = {“StatusMQT”:{“MqttHost”:“192.168.0.200”,“MqttPort”:1883,“MqttClientMask”:“sonoffSERCAM”,“MqttClient”:“sonoffSERCAM”,“MqttUser”:“openhabian”,“MqttType”:1,“MqttCount”:1,“MAX_PACKET_SIZE”:1000,“KEEPALIVE”:15}}
21:26:33 MQT: stat/sonoffSERCAM/STATUS7 = {“StatusTIM”:{“UTC”:“Thu Mar 14 20:26:33 2019”,“Local”:“Thu Mar 14 21:26:33 2019”,“StartDST”:“Sun Mar 31 02:00:00 2019”,“EndDST”:“Sun Oct 27 03:00:00 2019”,“Timezone”:"+01:00",“Sunrise”:“07:06”,“Sunset”:“18:53”}}
21:26:33 MQT: stat/sonoffSERCAM/STATUS10 = {“StatusSNS”:{“Time”:“2019-03-14T21:26:33”}}
21:26:33 MQT: stat/sonoffSERCAM/STATUS11 = {“StatusSTS”:{“Time”:“2019-03-14T21:26:33”,“Uptime”:“0T00:15:09”,“Vcc”:3.447,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER1”:“OFF”,“POWER2”:“OFF”,“Wifi”:{“AP”:1,“SSId”:“TP-LINK_88A51C”,“BSSId”:“64:66:B3:88:A5:1C”,“Channel”:9,“RSSI”:100,“LinkCount”:1,“Downtime”:“0T00:00:04”}}}
21:26:38 MQT: tele/sonoffSERCAM/STATE = {“Time”:“2019-03-14T21:26:38”,“Uptime”:“0T00:15:14”,“Vcc”:3.466,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER1”:“OFF”,“POWER2”:“OFF”,“Wifi”:{“AP”:1,“SSId”:“TP-LINK_88A51C”,“BSSId”:“64:66:B3:88:A5:1C”,“Channel”:9,“RSSI”:100,“LinkCount”:1,“Downtime”:“0T00:00:04”}}

21:27:35 CMD: Status2 0
21:27:35 MQT: stat/sonoffSERCAM/STATUS = {“Status”:{“Module”:39,“FriendlyName”:[“Sonoff”,“Sonoff2”],“Topic”:“sonoffSERCAM”,“ButtonTopic”:“0”,“Power”:0,“PowerOnState”:3,“LedState”:1,“SaveData”:1,“SaveState”:1,“SwitchTopic”:“0”,“SwitchMode”:[0,0,0,0,0,0,0,0],“ButtonRetain”:0,“SwitchRetain”:0,“SensorRetain”:0,“PowerRetain”:0}}
21:27:35 MQT: stat/sonoffSERCAM/STATUS1 = {“StatusPRM”:{“Baudrate”:115200,“GroupTopic”:“sonoffs”,“OtaUrl”:“http://thehackbox.org/tasmota/release/sonoff.bin",“RestartReason”:"Software/System restart”,“Uptime”:“0T00:16:11”,“StartupUTC”:“2019-03-14T20:11:24”,“Sleep”:50,“CfgHolder”:4617,“BootCount”:4,“SaveCount”:48,“SaveAddress”:“F4000”}}
21:27:35 MQT: stat/sonoffSERCAM/STATUS2 = {“StatusFWR”:{“Version”:“6.4.1.19(sonoff)”,“BuildDateTime”:“2019-03-14T21:16:01”,“Boot”:31,“Core”:“2_5_0”,“SDK”:“3.0.0-dev(c0f7b44)”}}
21:27:35 MQT: stat/sonoffSERCAM/STATUS3 = {“StatusLOG”:{“SerialLog”:2,“WebLog”:2,“SysLog”:0,“LogHost”:"",“LogPort”:514,“SSId”:[“TP-LINK_88A51C”,""],“TelePeriod”:300,“Resolution”:“558180C0”,“SetOption”:[“00008009”,“280500000100000000000000000000000000”,“00000000”]}}
21:27:35 MQT: stat/sonoffSERCAM/STATUS4 = {“StatusMEM”:{“ProgramSize”:587,“Free”:416,“Heap”:18,“ProgramFlashSize”:1024,“FlashSize”:1024,“FlashChipId”:“144051”,“FlashMode”:3,“Features”:[“00000809”,“0FDAE794”,“000783A0”,“23B617CE”,“00003BC0”]}}
21:27:35 MQT: stat/sonoffSERCAM/STATUS5 = {“StatusNET”:{“Hostname”:“sonoffSERCAM-2325”,“IPAddress”:“192.168.0.107”,“Gateway”:“192.168.0.1”,“Subnetmask”:“255.255.255.0”,“DNSServer”:“192.168.0.1”,“Mac”:“DC:4F:22:97:69:15”,“Webserver”:2,“WifiConfig”:4}}
21:27:35 MQT: stat/sonoffSERCAM/STATUS6 = {“StatusMQT”:{“MqttHost”:“192.168.0.200”,“MqttPort”:1883,“MqttClientMask”:“sonoffSERCAM”,“MqttClient”:“sonoffSERCAM”,“MqttUser”:“openhabian”,“MqttType”:1,“MqttCount”:1,“MAX_PACKET_SIZE”:1000,“KEEPALIVE”:15}}
21:27:35 MQT: stat/sonoffSERCAM/STATUS7 = {“StatusTIM”:{“UTC”:“Thu Mar 14 20:27:35 2019”,“Local”:“Thu Mar 14 21:27:35 2019”,“StartDST”:“Sun Mar 31 02:00:00 2019”,“EndDST”:“Sun Oct 27 03:00:00 2019”,“Timezone”:"+01:00",“Sunrise”:“07:06”,“Sunset”:“18:53”}}
21:27:35 MQT: stat/sonoffSERCAM/STATUS10 = {“StatusSNS”:{“Time”:“2019-03-14T21:27:35”}}
21:27:35 MQT: stat/sonoffSERCAM/STATUS11 = {“StatusSTS”:{“Time”:“2019-03-14T21:27:35”,“Uptime”:“0T00:16:11”,“Vcc”:3.447,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER1”:“OFF”,“POWER2”:“OFF”,“Wifi”:{“AP”:1,“SSId”:“TP-LINK_88A51C”,“BSSId”:“64:66:B3:88:A5:1C”,“Channel”:9,“RSSI”:100,“LinkCount”:1,“Downtime”:“0T00:00:04”}}}

But is it possible the problems is of the openhabian?

Didn’t see anything in those reports.
OK, let’s look into what openhab is sending to the sonoff, please post the log messages from the sonoff console when switching power1 and power2 to on.

2019-03-14 21:37:16.412 [ome.event.ItemCommandEvent] - Item ‘LivingRoom_Light1’ received command ON

2019-03-14 21:37:16.426 [nt.ItemStatePredictedEvent] - LivingRoom_Light1 predicted to become ON

2019-03-14 21:37:16.447 [vent.ItemStateChangedEvent] - LivingRoom_Light1 changed from OFF to ON

2019-03-14 21:37:16.632 [vent.ItemStateChangedEvent] - LivingRoom_Light1 changed from ON to OFF

Not the openhab log messages, the messages that the console of the tasmota webpage show. That way we see what openhab is sending.

21:39:20 MQT: stat/sonoffSERCAM/RESULT = {“POWER1”:“OFF”}
21:39:20 MQT: stat/sonoffSERCAM/POWER1 = OFF

But i turn on the power 1.
When i push on the switch 1 i see the switch go on e then automatically go to off

do you want to se again the file .items?

Do you have a software like MQTTfx as an external client in order to show all messages sent?
The console is not showing the actual command message (mine doesn’t either)

All I can do is look into all in order to find the difference, atm I’m lost.

Will continue tomorrow.

yes i have MQTTfx

Subscribe to all messages (#) and do the switching and see if there are differences.
If yes, the faulty behaviour is coming from openhab, if no it must be the sonoff device.

I’ll call it a day!

ok thank’s

Did some more reading/thinking.

You stated to have installed MQTT persistence. Did you set the Retain flag to any channel in PaperUI (you have to select “Show more” to see it)? Such COULD be the reason.
Look into this Video

On the screenshots, I’m missing the payload of the messages. Of interest are the messages “cmnd/sonoffSERCAM/POWER1” and “…2”, are both sending “ON” when you try to turn the switch to ON?

Yes i will control
I’ll be out for 2 days.
I will improve then


The flag of retained is not on