Rules on Mega version v2.0.0 2017-06-05 need some help
Posted: 22 Jun 2017, 22:36
The Setup
Relay on 12
LED on 13
Dummy device on task 12
Push butom active low on task 1 as sw_1#Switch1
When push buttom is push once, timerset,1 is set to wait for next press, and Dum#Sw is set to the number of presses. After timeout in Rules#Timer=1 the action is run as per Dum#Sw
Give me a push buttom with multiple run options
The following used to work on EspEasy R146, R148, but on Mega only the first press is run.
I also try it when i use the new feature of timerSet,1,0 to disable the timer before i set it again, but no luck.
Can someone give me some help on the rules.
Thanks
---Rule---
on switchoff do
gpio 12,0
gpio 13,1
inputswitchstate 0,0
endon
on switchon do
gpio 12,1
gpio 13,0
inputswitchstate 0,1
endon
on sw_1#Switch1 do
timerSet,1,3
gpio,13,1
delay,500
TaskValueSet 12,4,[Dum#Sw]+1
If [Dum#Sw]=1
Pulse,13,0,100
endif
If [Dum#Sw]=2
Pulse,13,0,100
delay,300
Pulse,13,0,100
endif
delay,500
gpio,13,1
endon
On Rules#Timer=1 do
If [Dum#Sw]=1
event,switchon
endif
if [Dum#Sw]=2
event,switchoff
Endif
TaskValueSet 12,4,0
endon
Relay on 12
LED on 13
Dummy device on task 12
Push butom active low on task 1 as sw_1#Switch1
When push buttom is push once, timerset,1 is set to wait for next press, and Dum#Sw is set to the number of presses. After timeout in Rules#Timer=1 the action is run as per Dum#Sw
Give me a push buttom with multiple run options
The following used to work on EspEasy R146, R148, but on Mega only the first press is run.
I also try it when i use the new feature of timerSet,1,0 to disable the timer before i set it again, but no luck.
Can someone give me some help on the rules.
Thanks
---Rule---
on switchoff do
gpio 12,0
gpio 13,1
inputswitchstate 0,0
endon
on switchon do
gpio 12,1
gpio 13,0
inputswitchstate 0,1
endon
on sw_1#Switch1 do
timerSet,1,3
gpio,13,1
delay,500
TaskValueSet 12,4,[Dum#Sw]+1
If [Dum#Sw]=1
Pulse,13,0,100
endif
If [Dum#Sw]=2
Pulse,13,0,100
delay,300
Pulse,13,0,100
endif
delay,500
gpio,13,1
endon
On Rules#Timer=1 do
If [Dum#Sw]=1
event,switchon
endif
if [Dum#Sw]=2
event,switchoff
Endif
TaskValueSet 12,4,0
endon