Openhab and Sonoff Switch


(Francesco) #21

I’m crazing :grinning:
Look now

sonoff.items

Switch Interruttore_1_wifi_Sonoff "Interruttore1 WiFi Sonoff" <light> (LR,gLight)
 {channel="mqtt:topic:b7bb37dc:Power1"}

Switch LivingRoom_Light "Interruttore2 WiFi Sonoff" <light> (LR,gLight)
 {channel="mqtt:topic:b7bb37dc:Power2"}


Interruttore2 WiFi Sonoff works but Interruttore1 WiFi Sonoff no


(Jürgen Baginski) #22

You changed the label(which can be identical) not the name!
You need:

Switch LivingRoom_Light1…
Switch LivingRoom_Light2…


(Francesco) #23
Switch LivingRoom_Light1 "Interruttore1 WiFi Sonoff" <light> (LR,gLight)
 {channel="mqtt:topic:b7bb37dc:Power1"}

Switch LivingRoom_Light2 "Interruttore2 WiFi Sonoff" <light> (LR,gLight)
 {channel="mqtt:topic:b7bb37dc:Power2"}

But it is the same


(Francesco) #24

The LivingRoom_Light2 works instead LivingRoom_Light1 only turn off


(Jürgen Baginski) #25

Confirm the switching of Power2 works correctly but Power1 does not?
What exactly does Power1 do?
What is the SwitchMode setting for relay1 of your sonoff? (You can check that on the webconsole of the sonoff).


(Francesco) #26

Confirm the switching of Power2 works correctly but Power1 does not?
YES

What exactly does Power1 do?
If is on i’m able to turn off it.
If is off i’m not able to control

What is the SwitchMode setting for relay1 of your sonoff? (You can check that on the webconsole of the sonoff).
It’s in default setting


(Francesco) #27

Look that

Switch LivingRoom_Light1 "Interruttore1 WiFi Sonoff" <light> (LR,gLight)
 {channel="mqtt:topic:b7bb37dc:Power1"}

Switch LivingRoom_Light2 "Interruttore2 WiFi Sonoff" <light> (LR,gLight)
 {channel="mqtt:topic:b7bb37dc:Power2"}

Is it possible i must separate the definition of the switch1 and 2?

When i push on the switch1 the log is

2019-03-13 22:25:19.978 [ome.event.ItemCommandEvent] - Item ‘LivingRoom_Light1’ received command ON

2019-03-13 22:25:20.000 [nt.ItemStatePredictedEvent] - LivingRoom_Light1 predicted to become ON

2019-03-13 22:25:20.005 [vent.ItemStateChangedEvent] - LivingRoom_Light1 changed from OFF to ON

2019-03-13 22:25:20.130 [vent.ItemStateChangedEvent] - LivingRoom_Light1 changed from ON to OFF


(CM6.5 H102) #28

You now need to restart OH, maybe even clean the cache, and see if everything starts working as expected.


(Francesco) #29

Ok now
I shotdown the raspberry and the sonoff.
I turn on the raspberry.
I open openhab
When i push on switch1 it turns on. When i push again it turns off.
Now i turn on sonoff.
When i push on switch1 it turns on and quickly turns off.

I don’t understand the motivation

Pls tell me what you want i show you…

From Tasmota i van control the switch without problems.
So isn’t it a problem of yhe setting of the firmware


(Jürgen Baginski) #30

For me it is not clear what you are saying, what is “Now i turn on sonoff.” ? You connected the sonoff to power? But what reacted on the push of Switch1 before that? Only the openHAB item displayed on a sitemap? Please explain in more detail when only the item reacts and when the actual sonoff switch reacts.


(Francesco) #31

yes

Before to connect the sonoff to power i touch the switch in openhab and the switch go on and if i touch the switch again it go off.
After i connect the sonoff to power if i touch the switch on openhab the switch go on and automatically go off. This only for the switch 1

No i see both


(Jürgen Baginski) #32

And doing the same with switch2 shows normal behaviour?
I do not see any reason for such behaviour🤔


(Francesco) #33

Yes with the switch2 i have not problems


(Hallo Ween) #34

Maybe you have misconfigured your sonoff inside tasmota? Can you post all of the webinterface-pages from the sonoff, in which you can edit the settings?


(Francesco) #35

I posted it in my first post of this topic
Anyway this evening i tried to reset all again


(Hallo Ween) #36

You only postet the page with the MQTT settings. But there are more pages, with switch config…


(Francesco) #37

This evening i will post all


(Francesco) #38

this is my setting of sonoff


When i turn on the switch1 on the console of sonoff i have:

18:46:48 MQT: stat/sonoffSERCAM/RESULT = {“POWER1”:“OFF”}
18:46:48 MQT: stat/sonoffSERCAM/POWER1 = OFF
this is the lod viewer of the openhab:

2019-03-14 18:46:49.150 [ome.event.ItemCommandEvent] - Item ‘LivingRoom_Light1’ received command ON

2019-03-14 18:46:49.158 [nt.ItemStatePredictedEvent] - LivingRoom_Light1 predicted to become ON

2019-03-14 18:46:49.182 [vent.ItemStateChangedEvent] - LivingRoom_Light1 changed from OFF to ON

2019-03-14 18:46:49.241 [vent.ItemStateChangedEvent] - LivingRoom_Light1 changed from ON to OFF


(Jürgen Baginski) #39

That sounds like this power switch is reverted, please check the setting for SwitchMode1 and SwichMode2


(Francesco) #40

what do you mean?