Openhab and Sonoff Switch

(Francesco) #61

I don’t think that this is the problem because the switching is not random.
The behaviour is this:
if the button in sonoff is on i’m able to turn off the button with openhab;
if the button in sonoff is off when i push the button in openhab this go on and then quickly to off. In this case the mqqt.fx:

from the console of the sonoff i have:
13:42:39 MQT: stat/sonoffSERCAM/RESULT = {“POWER1”:“OFF”}
13:42:39 MQT: stat/sonoffSERCAM/POWER1 = OFF
from the log viewr of the openhab
2019-03-15 13:42:39.809 [ome.event.ItemCommandEvent] - Item ‘LivingRoom_Light1’ received command ON

2019-03-15 13:42:39.817 [nt.ItemStatePredictedEvent] - LivingRoom_Light1 predicted to become ON

2019-03-15 13:42:39.828 [vent.ItemStateChangedEvent] - LivingRoom_Light1 changed from OFF to ON

2019-03-15 13:42:39.953 [vent.ItemStateChangedEvent] - LivingRoom_Light1 changed from ON to OFF

From the console of the sonoff it seems the command send only the OFF and never ON but i don’t understand why

(Jürgen Baginski) #62

I don’t have a clue why openhab would send an OFF for switching ON (except, you could have reverted such in the “Show More” part of the channel config by setting the ON/Open value deliberatly to OFF and vice versa, but that would not explain the switching ON then OFF).
Out of ideas!!:flushed:

(Francesco) #63

Help help

(Francesco) #64

I flashed with Tasmota again but it is the same

(CM6.5 H102) #65

Maybe something with the firmware, have you tried re-flashing the device to an earlier tasmota firmware version?

(Francesco) #66

I have just told it

(CM6.5 H102) #67

What versions have you tested with?

(Francesco) #68

But i am able to controll sonoff from tasmota without problems
But with openhab i am able to control the switch 2 but no the switch 1

(CM6.5 H102) #69

Is this a dual switch sonoff or are you using the extra gpio pin for another switch?

(Francesco) #70


(Francesco) #71

But do you think that if i change from switch to blinds the situation changes?

(CM6.5 H102) #72

Have you turned off serial logging?
Per the doc’s:
To assist easy installation serial logging is enabled by default in user_config.h for all Sonoffs. Once in production it’s wise to turn it off for all Sonoffs. For the Dual it is almost mandatory to turn it off.

Execute command seriallog 0 once to turn all communication on the serial port off.

Also, read thru this link and make sure you have everything setup as described.

(Francesco) #73

I’ll try the next week.

(Jürgen Baginski) #74

This topic kept popping up in my mind, so I made a test:
I did set deliberately the ON/Open to “OFF” and the OFF/Closed to ON", restarted openhab and got the same erratic behavior!
@fzonno, you screenshots of the channel settings did not show those settings, please check!

(Francesco) #75

Can you explain me better?
Have you an example?

(Jürgen Baginski) #76

Look into the Screenshots of your Channel config. Under the lines shown there are the settings for “On/Open” and “Off/Closed”. My test with setting the string “OFF” for the “On/Open” setting and “ON” for the opposite resulted in the same behaviour you observed.
Note that I had to restart after changing the setting (maybe because I use the setting via files).

(Francesco) #77

Tomorrow i will control.

(Francesco) #78

But in my case these fields are blank…

(Jürgen Baginski) #79

Can’t say if there is a default setting, however while observing such faulty behaviour I would try to set both to a desired string i.e.ON for “On/Open” and OFF for the opposite.
At least it is worth a try!

Checked the documentation, there are default settings which are supposed to set ON for “On/Open” and OFF for the opposite.
I would try to set them anyway, just in case.
Note that you did not show the actual sent payload of the command message received via MQTTFX, so it is not checked wether the switch does sent the correct payload.

(Francesco) #80

I solved so

but only for the channel 1