Code: Select all
on button1#state=1 do
timerset 1,1
endon
on rules#timer=1 do
if [button1#state]=0
Publish /esp01/button1/state,short
else
Publish /esp01/button1/state,long
endif
endon
Its not working
![Bedroeft :-(](./images/smilies/icon_e_sad.gif)
Thx
Moderators: grovkillen, Stuntteam, TD-er
Code: Select all
on button1#state=1 do
timerset 1,1
endon
on rules#timer=1 do
if [button1#state]=0
Publish /esp01/button1/state,short
else
Publish /esp01/button1/state,long
endif
endon
Code: Select all
timerSet,1,1
Code: Select all
on Button#State=1 do
timerSet,1,1
endon
on rules#timer=1 do
if [Button#State]=0
//Action if button is short pressed
else
//Action if button is still pressed
endif
endon
Code: Select all
on Button#State=1 do
delay,300
if [Button#State]=0
//Action1 if button is short pressed
else
//Action2 if button is still pressed
endif
endon
What is the message delay setting under advanced tab ?kociubin wrote: ↑22 Nov 2017, 23:18 I was hoping to do something like the code below instead (wanted to avoid having to wait 1 second for the first action to fire), but it doesn't work. Action1 is never triggered. Any idea how to work around this?
Code: Select all
on Button#State=1 do delay,300 if [Button#State]=0 //Action1 if button is short pressed else //Action2 if button is still pressed endif endon
This rule example in the wiki is from me and works like a charm. You don't have to wait 1 sec for an action. Switch delay is normally 0 and remove your delay of 300!kociubin wrote: ↑22 Nov 2017, 23:18 I was hoping to do something like the code below instead (wanted to avoid having to wait 1 second for the first action to fire), but it doesn't work. Action1 is never triggered. Any idea how to work around this?
Code: Select all
on Button#State=1 do [b][color=#FF0000] delay,300[/color][/b] if [Button#State]=0 //Action1 if button is short pressed else //Action2 if button is still pressed endif endon
Thanks for pointing that out!vader wrote: ↑23 Nov 2017, 16:23This rule example in the wiki is from me and works like a charm. You don't have to wait 1 sec for an action. Switch delay is normally 0 and remove your delay of 300!kociubin wrote: ↑22 Nov 2017, 23:18 I was hoping to do something like the code below instead (wanted to avoid having to wait 1 second for the first action to fire), but it doesn't work. Action1 is never triggered. Any idea how to work around this?
Code: Select all
on Button#State=1 do [b][color=#FF0000] delay,300[/color][/b] if [Button#State]=0 //Action1 if button is short pressed else //Action2 if button is still pressed endif endon
@grovkillen: It should make no difference if you type 'timerSet,1,1' or 'timerSet 1 1'. Check out 'GPIO,12,1' and 'GPIO 12 1'. Both set GPIO 12 to 1! The parser interprets 'space' and 'comma' as a separator.
vader wrote: ↑23 Nov 2017, 16:23
This rule example in the wiki is from me and works like a charm. You don't have to wait 1 sec for an action. Switch delay is normally 0 and remove your delay of 300!
@grovkillen: It should make no difference if you type 'timerSet,1,1' or 'timerSet 1 1'. Check out 'GPIO,12,1' and 'GPIO 12 1'. Both set GPIO 12 to 1! The parser interprets 'space' and 'comma' as a separator.
As grovkillen already pointed out please lower the "Message Delay" value in the advanced tab, by default is 1000ms (1 sec.) but I normally use 100ms (0.1sec) and it works like a charm!kociubin wrote: ↑24 Nov 2017, 16:50vader wrote: ↑23 Nov 2017, 16:23
This rule example in the wiki is from me and works like a charm. You don't have to wait 1 sec for an action. Switch delay is normally 0 and remove your delay of 300!
@grovkillen: It should make no difference if you type 'timerSet,1,1' or 'timerSet 1 1'. Check out 'GPIO,12,1' and 'GPIO 12 1'. Both set GPIO 12 to 1! The parser interprets 'space' and 'comma' as a separator.
I appreciate the response but my experience conflicts with your statement. I implemented your rule with a timerSet but I measure about 1 second minimum delay (which is not acceptable given my use case). This makes sense because "timerSet 1,1" creates a timer that fires in 1 second.
If you have any ideas on how to reduce the delay to around 200ms that would be great. BTW, I tried "timerSet,1,0.2" but that doesn't work.
Users browsing this forum: No registered users and 2 guests