EspEasy,relay recovery the last state after power failure

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
onizuka89
New user
Posts: 2
Joined: 27 Nov 2017, 22:58

EspEasy,relay recovery the last state after power failure

#1 Post by onizuka89 » 27 Nov 2017, 23:33

Hello to all, i've tried to search on the forum but I have not found a clear solution.
I have this scenario:
Domoticz 3.8153 on a raspberry pi
1 esp8266 flashed with esp easy v2.0.0-dev12 and a 4 relay modules

for now i've configured only 1 relay, but the problem is simple, i can control the relay using the domoticz web page using:
http://esp_ip_addr/control?cmd=GPIO,0,0
http://esp_ip_addr/control?cmd=GPIO,0,0
and all works fine, but if i reboot the esp, the relay state it is not mantained.
I think that the best solution is to ask at the domoticz controller to give me the state of that relay but i'm not able to do that
Anyone can help me?

PS:Sorry for my bad english

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: EspEasy,relay recovery the last state after power failure

#2 Post by toffel969 » 28 Nov 2017, 08:18

onizuka89 wrote: 27 Nov 2017, 23:33 Hello to all, i've tried to search on the forum but I have not found a clear solution.
I have this scenario:
Domoticz 3.8153 on a raspberry pi
1 esp8266 flashed with esp easy v2.0.0-dev12 and a 4 relay modules

for now i've configured only 1 relay, but the problem is simple, i can control the relay using the domoticz web page using:
http://esp_ip_addr/control?cmd=GPIO,0,0
http://esp_ip_addr/control?cmd=GPIO,0,0
and all works fine, but if i reboot the esp, the relay state it is not mantained.
I think that the best solution is to ask at the domoticz controller to give me the state of that relay but i'm not able to do that
Anyone can help me?

PS:Sorry for my bad english
I don't know exactly how it works, but I do now it is possible to implement the functionality using a MQTT broker. You essentially store the value and recall the value in a " On system#boot do" rule. It is somewhere on the forum
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: EspEasy,relay recovery the last state after power failure

#3 Post by vader » 28 Nov 2017, 09:43

Yep, with MQTT it works. Have it in use. The only trick you must know is, that the check mark 'send boot state' must be removed and 'MQTT retain message' be set. That works. ;)

onizuka89
New user
Posts: 2
Joined: 27 Nov 2017, 22:58

Re: EspEasy,relay recovery the last state after power failure

#4 Post by onizuka89 » 29 Nov 2017, 19:12

Yes, i know this option but i'm not able do this, because i set the mqtt gateway on domoticz, but which are the command that i have to use for power on and power off the esp pins?

These are my configurations:
In ESP
3.jpg
3.jpg (227.82 KiB) Viewed 5985 times
And In Domoticz
1.jpg
1.jpg (244.19 KiB) Viewed 5985 times
2.jpg
2.jpg (244.26 KiB) Viewed 5985 times

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: EspEasy,relay recovery the last state after power failure

#5 Post by vader » 30 Nov 2017, 10:22

You must use the _P029 (Domoticz MQTT helper) plug-in in ESPeasy to get this work. Check, that the IDX is the same like in Domoticz! Then your red marked fields stay empty in Domoticz (only for HTTP commands).

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

Re: EspEasy,relay recovery the last state after power failure

#6 Post by kimot » 07 Dec 2017, 21:53

Or you can periodically send state of relays from Domoticz to ESPeasy with LUA scripts - for every minutes for example.
Then max. 1 minute after reboot relays will obtain its correct state.

Or when booting ESP, send through rules JSON command to Domoticz ( setting variable or dummy switch "ESP_is_booting")
End in Domoticz with LUA or Blockly send back Correct GPIO command when variable or switch is changed.

And at last, I think in ESP MEGA GPIO states and task values are not changed after boot ( of course not, if power is lost ).
I am not sure ( about GPIOs ), but I remember I read this somewhere - so try it.
Task values holds its data after rebooting.
I count number of actions of my relay in my ESP for example and after reboot it continued from last value before reboot.

Post Reply

Who is online

Users browsing this forum: No registered users and 87 guests