Hello,
I want to use esp8266 with a relay connected to domoticz. It works.
Flashed with R120
The switch is a push button which is also soldered to this esp8266.
In espeasy I configured it
device: switch input
switch type: switch
switch button type: Push Button Active High
In Domoticz I created: Light/Switch, Switch, On/Off
My Problem:
When i toggle on the light with domoticz and then i want to toggle the light off by hitting push button, then I have to do it 2x times until light goes off.
It's because the state of light in esp8266 is not synchronized with light state of domoticz and I dont know how solve this problem?
I tried it with espeasy command "TaskValueSet" to change the value of switch state but it doenst work.
I also tried with Blockly (I am new to this) but these If-do-else-if within If-do doesn't work ? Programming with Blockly seems to be very limited, am I right?
Light state problem with espeasy
Moderator: leecollings
- heggink
- Posts: 980
- Joined: Tuesday 08 September 2015 21:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12451
- Location: NL
- Contact:
Re: Light state problem with espeasy
Assuming you are using the native domopticz interface instead of mqtt, your challenge is a typical one. espeasy tells domotics any switch state but domoticz needs to tell easeasy to switch as well.
I have multiple espeasy switches in my house, both mono and bi-stable (click and toggle). assuming you are using a regular bi-stable switch, you can do the following:
define a dummy switch in easpeasy as first device (rules below will switch it with taskvalueset and task 1)
create a real switch in espeasy and call it sense (so the rile below activates teh dummy on any sense change)
create a couple of rules:
on knopon do
TaskValueSet 1,1,1
endon
on knopoff do
TaskValueSet 1,1,0
endon
on sense#Switch do
if [TestSwitch#Dummy]=0
TaskValueSet 1,1,1
SendToHTTP IPANDPORT,/json.htm?param=switchlight&type=command&switchcmd=On&idx=IDOFTHEDUMMY
else
TaskValueSet 1,1,0
SendToHTTP IPANDPORT,/json.htm?param=switchlight&type=command&switchcmd=Off&idx=IDOFTHEDUMMY
endif
endon
in domoticz, for the dummy device add the following:
on action:
http://ESPDEVIP/control?cmd=event,knopon
off action:
http://pavoswitch/control?cmd=event,knopoff
what happens is that domoticz will trigger the knopon and knopoff rules that switch the dummy device on/off, same with the physical switch. That way, the dummy device in domoticz is always synced with the esp dummy switch. you can then build rules in domoticz based on the state of the domoticz dummy switch.
as said, I have used this approach for both bi-stable and mono-stable switches. I tried to sync the dummy esp device directly with domoticz but esp keeps updating the domoticz switch with the delay interval so that didn't work for me. I opted to update based on the rules. I can also advice you to use the 147 fw instead of the 120. very stable for me.
I have multiple espeasy switches in my house, both mono and bi-stable (click and toggle). assuming you are using a regular bi-stable switch, you can do the following:
define a dummy switch in easpeasy as first device (rules below will switch it with taskvalueset and task 1)
create a real switch in espeasy and call it sense (so the rile below activates teh dummy on any sense change)
create a couple of rules:
on knopon do
TaskValueSet 1,1,1
endon
on knopoff do
TaskValueSet 1,1,0
endon
on sense#Switch do
if [TestSwitch#Dummy]=0
TaskValueSet 1,1,1
SendToHTTP IPANDPORT,/json.htm?param=switchlight&type=command&switchcmd=On&idx=IDOFTHEDUMMY
else
TaskValueSet 1,1,0
SendToHTTP IPANDPORT,/json.htm?param=switchlight&type=command&switchcmd=Off&idx=IDOFTHEDUMMY
endif
endon
in domoticz, for the dummy device add the following:
on action:
http://ESPDEVIP/control?cmd=event,knopon
off action:
http://pavoswitch/control?cmd=event,knopoff
what happens is that domoticz will trigger the knopon and knopoff rules that switch the dummy device on/off, same with the physical switch. That way, the dummy device in domoticz is always synced with the esp dummy switch. you can then build rules in domoticz based on the state of the domoticz dummy switch.
as said, I have used this approach for both bi-stable and mono-stable switches. I tried to sync the dummy esp device directly with domoticz but esp keeps updating the domoticz switch with the delay interval so that didn't work for me. I opted to update based on the rules. I can also advice you to use the 147 fw instead of the 120. very stable for me.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
Re: Light state problem with espeasy
Whow, it works. Thank you very much!
- heggink
- Posts: 980
- Joined: Tuesday 08 September 2015 21:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12451
- Location: NL
- Contact:
Re: Light state problem with espeasy
Glad it works!
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
Who is online
Users browsing this forum: No registered users and 1 guest