sonoff manual control

Post Reply
jackwan1
Posts: 19
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 3.7323
Location: USA
Contact:

sonoff manual control

Post by jackwan1 » Thursday 20 April 2017 19:02

I created a virtual switch in domoticz for my sonoff(basic) device flashed with espeasy R147

I do not have problem to control the switch via domoticz or apple app Pilot

However, I just realize that manual control switch (GPIO0) is not working properly

I did put in the following standard rules in espeasy
on lightswitch#Switch do
if [status#Switch]=0
gpio,12,1
else
gpio,12,0
endif
endon

I have the following problems

1. If the sonoff is turned on by software, I can press the gpio0 button to turn it off, but cannot turn it on.
2. If the sonoff is turned off by software, I cannot press the button to turn it on
3. If I manually turn off the sonoff, domoticz does not report its been turned off

I am using http to control the switch in domoticz

Please help

User avatar
sincze
Posts: 728
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.8153
Location: Netherlands
Contact:

Re: sonoff manual control

Post by sincze » Thursday 20 April 2017 21:23

Check my post here for a working solution for your rules.

https://www.domoticz.com/forum/viewtopi ... 20#p121751
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

jackwan1
Posts: 19
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 3.7323
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 » Friday 21 April 2017 1:59

Thank you @sincze
I followed your instructions, everything is working. the only thing is that the Domoticz is not updated when I operate manually.
So when you manually operate the switch to turn it on, Domoticz status is still off.

I guess it is only one way street in http command. I guess I have to try Domoticz in mqtt mode and I do have an mqtt server running.

User avatar
sincze
Posts: 728
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.8153
Location: Netherlands
Contact:

Re: sonoff manual control

Post by sincze » Friday 21 April 2017 13:23

jackwan1 wrote:Thank you @sincze
I followed your instructions, everything is working. the only thing is that the Domoticz is not updated when I operate manually.
So when you manually operate the switch to turn it on, Domoticz status is still off.

I guess it is only one way street in http command. I guess I have to try Domoticz in mqtt mode and I do have an mqtt server running.
MMM
I just tried the following.
Light is OFF.
Press the small black button.. the light goes on.. the domoticz icon lights up.
Press the small black button again.. the light goes off .. the the domoticz icon switches off.

Light is OFF.
Press the small black button.. the light goes on.. the domoticz icon lights up.
Press the domoticz light icon.. the light goes out.

Light is OFF.
Press Domoticz light button... light goes on.
Press the black button. light goes out and domoticz icon light goes out as well.

This is working according the specification I would say. Domoticz and physical light are in sync.
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

jackwan1
Posts: 19
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 3.7323
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 » Friday 21 April 2017 20:45

Maybe I did some thing wrong. The thing I am always wondering is that in the Hardware entry(Dummy), should I create One Sonoff per HW entry or can I have many switches per HW entry? I put 3 Sonoffs under one HW entry and the idx I used are the same in Espeasy.

jackwan1
Posts: 19
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 3.7323
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 » Friday 21 April 2017 21:42

Here is my setup

I have since added separate HW definitions but still did not work
Rules

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

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

on SW_1#Switch do
if [SW_1#Switch]=1
gpio,12,1
gpio,13,0
else
gpio,12,0
gpio,13,1
endif
endon
Attachments
sonoff2.jpg
sonoff2.jpg (237.11 KiB) Viewed 6766 times
sonoff1.jpg
sonoff1.jpg (237.08 KiB) Viewed 6766 times
sonoff.jpg
sonoff.jpg (360.3 KiB) Viewed 6768 times

User avatar
Westcott
Posts: 547
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: sonoff manual control

Post by Westcott » Friday 21 April 2017 22:04

Hi Jackwan1,

What you seem to have done is created 4 hardware nodes in Domoticz and used their idxes.
What I think you need to do is have just one hardware node 'Sonoff' and create 4 dummy switches in it - Sonoff1-4.
Then use the idxes of these dummy switches in the ESPeasy devices.
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

jackwan1
Posts: 19
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 3.7323
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 » Friday 21 April 2017 23:29

Thanks
But I did exactly as you described before. I created one Dummy Switch and put all virtual sensors (sonoff switches) under that HW switch.
It did not report the correct status of the switch as I described before. The virtual Idx under "device"was entered and did not work

jackwan1
Posts: 19
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 3.7323
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 » Friday 21 April 2017 23:40

ok, now I deleted all the settings and start from scratch. The confusion is the Dummy HW idx and the Virtual Switch idx on the device list. Which one I should use in the espeasy? And if they are identical would that cause problems? Like right now the Dummy HW idx is 2 and one of the virtual switch also has idx 2.

jackwan1
Posts: 19
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 3.7323
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 » Saturday 22 April 2017 0:00

Ok, its all good. By trial and error, I now know that the idx in "Device" list is going to be used not the idx in the"Hardware" list should be used. The status sync is all good.

tontze
Posts: 242
Joined: Thursday 12 January 2017 16:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: sonoff manual control

Post by tontze » Saturday 22 April 2017 10:18

HI !

Im really new with ESPEasy and stuff, but i would like to find cheap wall switch that can be controlled via domoticz and its status be updated in domoticz if operated directly. I found this :

https://www.itead.cc/sonoff-touch.html

And :

https://github.com/arendst/Sonoff-MQTT-OTA-Arduino
https://github.com/arendst/Sonoff-Tasmota

Would above thread work with this too ?

Thanks ! -T
-----------------------------------------
Rpi 3 / Razberry 2
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
ESP82xx

jackwan1
Posts: 19
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 3.7323
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 » Monday 24 April 2017 1:06

Sonoff Touch is using a different chip esp8265 not esp8266 as all the others.
You need to find the right espeasy version (I believe R148) to flash it and it is difficult to ground the gpio0 when flashing.

https://github.com/davidmpye/Sonoff-Tou ... w-to-flash

Once it is flashed, you should be able to use in Domoticz

I have two, but I am too lazy to pull it from the wall to try

tontze
Posts: 242
Joined: Thursday 12 January 2017 16:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: sonoff manual control

Post by tontze » Monday 24 April 2017 19:16

ok cool, i ordered one and lets see when it arrives :)
-----------------------------------------
Rpi 3 / Razberry 2
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
ESP82xx

jackwan1
Posts: 19
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 3.7323
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 » Thursday 27 April 2017 0:47

Thanks to @sinze who spent the time to set up sonoff switch in Domoticz using the procedures in the following thread:

https://www.domoticz.com/forum/viewtopi ... 20#p121751

It worked fine, but strangely, I receive two prowl notifications each time I turn on and off using Domoticz
Further investigation found that in the Domoticz switch log there were two entries each for on and off
Trial and error found that there is nothing wrong with his Domoticz setup but the Espeasy setting needs to be modified as follows:

1. In ESPeasy devices there should be only ONE switch device entry:
The double entries in Domoticz log is caused by TWO switch Espeasy device entries as defined by @Sincz.
sonoffa.jpg
sonoffa.jpg (233.77 KiB) Viewed 6588 times
2. There is a slight change in the Switch setting:
Please note that Idx in the switch setting is significant, mine is 1, yours could be some thing else. That idx should correspond with your switch(device) setting in the Domoticz
sonoffb.jpg
sonoffb.jpg (251.49 KiB) Viewed 6588 times
There is no change in Espeasy rules as @sinze posted.

Its all good from there

corederoma82
Posts: 36
Joined: Saturday 14 January 2017 22:34
Target OS: Windows
Domoticz version:
Contact:

Re: sonoff manual control

Post by corederoma82 » Sunday 23 July 2017 12:52

Hi guys,
I have a sonoff switch that I have uodated with EaspEasy firmware.
It seems work because when I push the sonoff button, in software the status became 1 and if I re-push the button the status became 0.
I have problem when I connect the Sonoff Switch at my boiler; the voltage is ok, the Sonoff is on and work but when I press the switch button the led boiler is always swtich off.

Thanks

tontze
Posts: 242
Joined: Thursday 12 January 2017 16:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: sonoff manual control

Post by tontze » Wednesday 26 July 2017 8:40

corederoma82 wrote:Hi guys,
I have a sonoff switch that I have uodated with EaspEasy firmware.
It seems work because when I push the sonoff button, in software the status became 1 and if I re-push the button the status became 0.
I have problem when I connect the Sonoff Switch at my boiler; the voltage is ok, the Sonoff is on and work but when I press the switch button the led boiler is always swtich off.

Thanks
i think you need also switch state of the switch, not only status ? Status is for telling other devices whats is its state ?
-----------------------------------------
Rpi 3 / Razberry 2
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
ESP82xx

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest