everytime ESPeasy boot i need GPIO0 remain to state 1 for 30 seconds and then come back to 0.
if during the timer GPIO 2 and/or gpio 1 are set to 1... Timer restart.
Anyone can help me?
Timer Rule in ESPeasy
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 11
- Joined: 10 Oct 2016, 00:45
Re: Timer Rule in ESPeasy
update... i successfully create the timer rule but i still cannot reset the timer everytime the gpio1 and 2 goes to 1
On System#Boot do
gpio,0,1
timerSet,1,50
endon
On Rules#Timer=1 do
gpio,0,0
endon
On System#Boot do
gpio,0,1
timerSet,1,50
endon
On Rules#Timer=1 do
gpio,0,0
endon
Re: Timer Rule in ESPeasy
I am not sure if I understand your problem, but maybe you can try something like this:
1. Create a Dummy device (e.g. Dummy#TimerSet on e.g. Task 1, value 1)
2. Assign your GPIO inputs to a device, like a switch (e.g. Input1#Switch, Input2#Switch)
On System#Boot do
gpio,0,1
timerSet,1,50
TaskValueSet 1,1,1 // set a flag on the Dummy device indicating that your timer is active
endon
On Rules#Timer=1 do
gpio,0,0
TaskValueSet 1,1,0 // reset the timer flag
endon
On Input1#Switch=1 do
if [Dummy#TimerSet] = 1 // checking the flag to see if the timer is still running
timerSet,1,50 // if the timer is running, reset the timer again to 50... or did you want to cancel the timer...?
endif
endon
On Input2#Switch=1 do
if [Dummy#TimerSet] = 1 // checking the flag to see if the timer is still running
timerSet,1,50
endif
endon
----------------
if you wanted to actually cancel the timer, then you will need to place a check (if) in the On Rules#Timer routine.. so just rearranging this concept.
Not sure if it works this way, but you are welcome to try.
1. Create a Dummy device (e.g. Dummy#TimerSet on e.g. Task 1, value 1)
2. Assign your GPIO inputs to a device, like a switch (e.g. Input1#Switch, Input2#Switch)
On System#Boot do
gpio,0,1
timerSet,1,50
TaskValueSet 1,1,1 // set a flag on the Dummy device indicating that your timer is active
endon
On Rules#Timer=1 do
gpio,0,0
TaskValueSet 1,1,0 // reset the timer flag
endon
On Input1#Switch=1 do
if [Dummy#TimerSet] = 1 // checking the flag to see if the timer is still running
timerSet,1,50 // if the timer is running, reset the timer again to 50... or did you want to cancel the timer...?
endif
endon
On Input2#Switch=1 do
if [Dummy#TimerSet] = 1 // checking the flag to see if the timer is still running
timerSet,1,50
endif
endon
----------------
if you wanted to actually cancel the timer, then you will need to place a check (if) in the On Rules#Timer routine.. so just rearranging this concept.
Not sure if it works this way, but you are welcome to try.
-
- Normal user
- Posts: 11
- Joined: 10 Oct 2016, 00:45
Re: Timer Rule in ESPeasy
hi.. not working.. maybe the logic of the rule is wrong...
tryng to write a rule...
Until Switch#PIR (gpio2) or/and Switch#contact(gpio5) are to 1 mantain GPIO0 = 1...
Wait until twice PIR and contact are 0
wait 5 Seconds
gpio = 0
but can i do multiple condition in the if... or use while command?
tryng to write a rule...
Until Switch#PIR (gpio2) or/and Switch#contact(gpio5) are to 1 mantain GPIO0 = 1...
Wait until twice PIR and contact are 0
wait 5 Seconds
gpio = 0
but can i do multiple condition in the if... or use while command?
Re: Timer Rule in ESPeasy
Something like this?
Is there a reason to remember the fact that the timer runs?
1. Assign your GPIO inputs to a device, like a switch (e.g. Input1#Switch, Input2#Switch)
On System#Boot do
gpio,0,1
timerSet,1,50
endon
On Rules#Timer=1 do
gpio,0,0
endon
On Input1#Switch=1 do
timerSet,1,50 // if the timer is running, reset the timer again to 50... or did you want to cancel the timer...?
endon
On Input2#Switch=1 do
timerSet,1,50
endon
Is there a reason to remember the fact that the timer runs?
1. Assign your GPIO inputs to a device, like a switch (e.g. Input1#Switch, Input2#Switch)
On System#Boot do
gpio,0,1
timerSet,1,50
endon
On Rules#Timer=1 do
gpio,0,0
endon
On Input1#Switch=1 do
timerSet,1,50 // if the timer is running, reset the timer again to 50... or did you want to cancel the timer...?
endon
On Input2#Switch=1 do
timerSet,1,50
endon
Who is online
Users browsing this forum: No registered users and 6 guests