Hello.
I use and esp8266 vith espeasy 2.0 firmware to control a relay that does some plant irrigation.
The commands are sent via MQTT.
I had a problem: as the esp8266 is connected via internet: yesterday I sent a MQTT command to activate the relay ("gpio,12,0") but then the internet connection failed. So there was no way to interrupt the irrigation. The solution was to go there and pull the power cord
Now the question: Is there the possibility to have a timer so that if the esp receives "gpio,12,0" after say 15 minutes he will "gpio,12,2", so the relay will shut off even without internet connection. This will be a security...
Thanks for your help, ciao Gianluca
Relay and internal timer
Moderators: grovkillen, Stuntteam, TD-er
- dynamicdave
- Normal user
- Posts: 257
- Joined: 30 Jan 2017, 20:25
- Location: Hampshire, UK
Re: Relay and internal timer
First idea that springs to mind is to send an 'event-commnad' (via MQTT) to the Wemos.
Set-up a Rule-Set (in the Wemos) to listen for the event-command, and in the rule-set set the GPIO (gpio 12) and also trigger a timer for 15-minutes.
If your main server (or whatever is sending the MQTT commands) goes off-line and is unable to send the command to turn the GPIO off, then after 15-minutes the timer expires.
This will trigger another rule that will turn the GPIO off.
So one way or another the GPIO pin gets turned off.
When I have a few spare minutes I'll rough out a 'rule' for you.
Cheers from David.
Set-up a Rule-Set (in the Wemos) to listen for the event-command, and in the rule-set set the GPIO (gpio 12) and also trigger a timer for 15-minutes.
If your main server (or whatever is sending the MQTT commands) goes off-line and is unable to send the command to turn the GPIO off, then after 15-minutes the timer expires.
This will trigger another rule that will turn the GPIO off.
So one way or another the GPIO pin gets turned off.
When I have a few spare minutes I'll rough out a 'rule' for you.
Cheers from David.
- dynamicdave
- Normal user
- Posts: 257
- Joined: 30 Jan 2017, 20:25
- Location: Hampshire, UK
Re: Relay and internal timer
Something like this should work...
Code: Select all
On startWatering Do
gpio,12,1 //Activate the relay
TimerSet,1,900 //Start the timer for 15-mins
EndOn
On stopWatering Do
gpio,12,0 //Deactivate the relay
TimerSet,1,0 //Reset the timer
EndOn
On Rules#Timer=1 Do
gpio,12,0 //Deactivate the relay
EndOn
Re: Relay and internal timer
Longpulse works also, you free a timer.
Belgium and land of ESP ... counting
Re: Relay and internal timer
@dynamicdave thank you for helping me!
@HomeJCL how can I tell longpulse that I need the 0 and 2 values on the gpio and not 0 and 1 (to activate and deactivate)? Longpulse accepts only seconds and one value...
Gianluca
@HomeJCL how can I tell longpulse that I need the 0 and 2 values on the gpio and not 0 and 1 (to activate and deactivate)? Longpulse accepts only seconds and one value...
Gianluca
Who is online
Users browsing this forum: No registered users and 31 guests