Rules on Mega version v2.0.0 2017-06-05 need some help

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Henry
New user
Posts: 3
Joined: 22 Jun 2017, 21:11

Rules on Mega version v2.0.0 2017-06-05 need some help

#1 Post by Henry » 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

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

Re: Rules on Mega version v2.0.0 2017-06-05 need some help

#2 Post by toffel969 » 30 Jun 2017, 14:03

Hi

I'm taking a bit of a wild guess here, but it won't harm to try it.

Your rules syntax looks ok, but the use of seperartor is inconsistent (space or comma) . Maybe there is a change in the way the rules are interpreted.

Try

Code: Select all

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
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

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

Re: Rules on Mega version v2.0.0 2017-06-05 need some help

#3 Post by toffel969 » 30 Jun 2017, 14:09

An something else :

Code: Select all

on sw_1#Switch1 do
Triggers every time that the switch changes its state, assuming a momentay push button connected between gpio and GND. So for one button press it should trigger twice.

From what I understand, this is not the behaviour you intented. As far as I understand, you want to register button presses.

Maybe try

Code: Select all

on sw_1#Switch1=0 do
instead, as this rule will only trigger when the button once.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 92 guests