sonoff manual control

Moderator: leecollings

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

sonoff manual control

Post by jackwan1 »

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: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: sonoff manual control

Post by sincze »

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

https://www.domoticz.com/forum/viewtopi ... 20#p121751
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
jackwan1
Posts: 41
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 2020.2
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 »

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: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: sonoff manual control

Post by sincze »

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.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
jackwan1
Posts: 41
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 2020.2
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 »

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: 41
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 2020.2
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 »

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 14846 times
sonoff1.jpg
sonoff1.jpg (237.08 KiB) Viewed 14846 times
sonoff.jpg
sonoff.jpg (360.3 KiB) Viewed 14848 times
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: sonoff manual control

Post by Westcott »

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, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
jackwan1
Posts: 41
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 2020.2
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 »

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: 41
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 2020.2
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 »

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: 41
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 2020.2
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 »

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: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: sonoff manual control

Post by tontze »

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
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
jackwan1
Posts: 41
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 2020.2
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 »

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: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: sonoff manual control

Post by tontze »

ok cool, i ordered one and lets see when it arrives :)
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
jackwan1
Posts: 41
Joined: Saturday 15 April 2017 20:04
Target OS: Linux
Domoticz version: 2020.2
Location: USA
Contact:

Re: sonoff manual control

Post by jackwan1 »

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 14668 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 14668 times
There is no change in Espeasy rules as @sinze posted.

Its all good from there
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: sonoff manual control

Post by corederoma82 »

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
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: sonoff manual control

Post by tontze »

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 ?
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest