Sonoff basic with wall switch

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: Sonoff basic with wall switch

#21 Post by kimot » 19 Feb 2018, 20:04

You must set correct switch mode in ESPeasy.
"Switch Button Type: Normal Switch or Push Button
It depends on your mechanical switch type.
If you have got push button, select Push Button and then each press of switch changes relay state.
If You have got ON/OFF switch, select normal switch and then each change of state this switch will change state of relay.

And on ESPeasy uncheck "send to controller" on relay device.
Do not write IDX there, its not needed, you send command via http request.

And on Domoticz side:
Dom_01.png
Dom_01.png (319.53 KiB) Viewed 18648 times
If you have god checked send to controller, there will be some message pingpong between Domoticz and ESPEasy.

With my setup, if you switch relay in Domoticz, ESPeasy will set GPIO and do nothing.
If you press switch on ESPeasy ( sonoff ), ESPeasy sets GPIO and sends relay state to Domoticz.
And Domoticz in this moment sends back relay state to ESPeasy, but it is previously set to the same value, so it is not too wrong.

remko2000
Normal user
Posts: 68
Joined: 28 Dec 2017, 15:56

Re: Sonoff basic with wall switch

#22 Post by remko2000 » 20 Feb 2018, 21:48

I have finally been able to flash the latest build (v2.0-20180220) on my sonoff basic.
Now I can continue with the actual problem.
If I want to switch my sonoff the signal seems to be pingpong so the sonoff switches on and off several times.
What have I done now:
I have 1 virtual switch in domoticz with on-off action:
-http://10.0.1.39/control?cmd=event,lamp_on
-http://10.0.1.39/control?cmd=event,lamp_off

In the ESP software I added two devices for my sonoff. 1 for GPIO-12 (called 'rele') and 1 for GPIO-14 (called ' SW01).

On the GPIO12 I connected a light. Image

On the GPIO14 I connected a normal wall switch (to my light) to ground and GPIO12 of my sonoff.

Image

As a rule I added:

Code: Select all

on lamp_on do
    gpio,12,1
    gpio,13,0
endon

on lamp_off do
    gpio,12,0
    gpio,13,1
endon

on lamp_change do
  if [rele#Switch]=1
    event,lamp_off
    SendToHTTP 10.0.1.32,8080,/json.htm?type=command&param=switchlight&idx=1266&switchcmd=Off
  else
    event,lamp_on
    SendToHTTP 10.0.1.32,8080,/json.htm?type=command&param=switchlight&idx=1266&switchcmd=On
  endif
endon

on SW01#Switch do
  event,lamp_change
endon
What I'm trying to achieve is that I can operate my light with the wall switch, but also from domoticz.

My gueass is that the rule isn't right and that's wy the signal pingpong but I can not figure it out. Can please someone help me?

remko2000
Normal user
Posts: 68
Joined: 28 Dec 2017, 15:56

Re: Sonoff basic with wall switch

#23 Post by remko2000 » 23 Feb 2018, 10:18

After some googling, I found out that a 10K resistance between GPIO14 and 3.3V could help. I have tried this and indeed it works perfectly now. Code is also correct. I can switch my lamp both with my wall switch and via domiticz and the status is perefect kept in domoticz.

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: Sonoff basic with wall switch

#24 Post by kimot » 23 Feb 2018, 22:44

Or enable internal pullup on SW01 device tab.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 113 guests