I’ve a few ESP8266 devices that I’ve flashed with ESP Easy, which works really well. Just need some help with regard to power cycling. Would it be possible to set the relay to “on” once power has been cycled ie switching a physical light switch on without it needing to fetch the switch state from HASS?
I assume one would do this using rules on the MQTT device itself, if so how?
Thanks alot for the replies. I’ve gone with piotr’s suggestion.
I think all the firmwares have an issue though… If you power cycle off the device and back on, the relay switches on, as needed, but after a few seconds, due to the status in HASS, the device switches off. Is there any way to ignore this during power cycling? Does the retain flag in HASS compromise the state?
I may have found the issue. Once I connect to the MQTT broker and restart the light switches on momentarily then off. The mosquitto.db has the device listed with an OFF flag. Is there any way to default this to ON, or am I looking int he right place?
If using the Electrodragon with ESPEasy and Home Assistant via MQTT, the “Send Boot state” must be unchecked otherwise the button will send its state (high) on boot and toggle back based on the “Retained flag” on the MQTT broker.
@xbmcnut i have made a esp8266 socket with the help of your blog. if i turn on the socket from HA and reboot HA it doesn’t remember the state of the switch is there any way i can fix this please help me.?
What version of ESP Easy are you using. Do you have the global “retain flag” option set in ESP Easy and does your HA yaml code also have the MQTT retain option added?
Yep, as per the blog, the retain flag option was added in version R121 and above under Tools > Advanced. Without that ticked, the connecting client (HA, phone app etc.), won’t know that last know state so will report the device as off. You can simply upload R147 using the web GUI under Tools > Firmware > Upload.
i re flashed 147 and it worked.thanks guys i upgraded now status are working after reboot…next want to make with a 4 channel relay with buttons to control it
@xbmcnut@oriolism hello is it possible to do a long press in esp easy rule ? im making a switch board with 4 channel relay and 4 switch but i want one of the button to act as master switch when long pressed everything ON long pressed again everything OFF is it possible?
so far my rule is this.
on button1#button1 do
if [relay1#relay1] =0
GPIO,16,1
else
GPIO,16,0
endif
endon
on button2#button2 do
if [relay2#relay2] =0
GPIO,14,1
else
GPIO,14,0
endif
endon
on button3#button3 do
if [relay3#relay3] =0
GPIO,13,1
else
GPIO,13,0
endif
endon
on button4#button4 do
if [relay4#relay4] =0
GPIO,2,1
else
GPIO,2,0
endif
endon
Take a look here https://www.letscontrolit.com/forum/viewtopic.php?t=2637 although I see you’ve asked your question there. Did the info in that thread not assist? I’m not a rules guru so the folks at the ESPEasy forum might be a better bet?