Openhab and Sonoff Switch

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

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:

:grimacing:
Help help

I flashed with Tasmota again but it is the same

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

Yes
I have just told it

What versions have you tested with?

6.4
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

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

Dual

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

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.

I’ll try the next week.
Thank’s

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!

Can you explain me better?
Have you an example?

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).

Tomorrow i will control.
Thank’s

But in my case these fields are blank…

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!

[Edit]
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.

1 Like

Magic
I solved so


but only for the channel 1
Thank’s

1 Like