Hi There,
I seem to have a long press Action problem on my ESPEasy since the last update to 20220427 (before I had a Version from 2020 or so...)
When I test, I can see no 10 or 11 for the Switch value, only 0 and 1 during Button press. (btw. I do not see a 3 when double press enabled)
here is my configuration:
And here I can see only 0 or 1 for the Value
I also had a Longpress Action in my Rules that worked with the old SW but not yet. (Hardware was not changed, everything else worked well)
I could help me with some Rules that create the long press with an extra Timer, but ...
This does not longer work:
on Taster1#Switch>=10 do
... // longpress action
endon
So I changed to:
on Taster1#Switch do
Timerset,1,2 // set longpress Timer to 2 sek
endon
on Rules#Timer=1 do
if [Taster1#Switch]=1 // if still pressed
// longpress action
endif
endon
So workaround is found but want to know if I made an mistake...
Thanks for any hints and best regards!
Long press for Button problems?
Moderators: grovkillen, Stuntteam, TD-er
Re: Long press for Button problems?
Any such change is unintended.
I will look into it.
Do you have some setting on the Tools->Advanced page to reorder events (next to the rules cache checkbox)
If you have it, make sure to disable it. (not the cache, but reorder events)
In the current code, it is already removed as it does have quite a lot of side-effects.
You can also try one of the latest GitHub Actions builds, like this one:
https://github.com/letscontrolit/ESPEas ... 2955301189
You need to be logged in into GitHub to download artifacts.
You then need to download the "Binaries" zip file in which there are all the bin files.
I will look into it.
Do you have some setting on the Tools->Advanced page to reorder events (next to the rules cache checkbox)
If you have it, make sure to disable it. (not the cache, but reorder events)
In the current code, it is already removed as it does have quite a lot of side-effects.
You can also try one of the latest GitHub Actions builds, like this one:
https://github.com/letscontrolit/ESPEas ... 2955301189
You need to be logged in into GitHub to download artifacts.
You then need to download the "Binaries" zip file in which there are all the bin files.
Re: Long press for Button problems?
I created a task on my test node running the latest code.
This task was configured like in your screenshot.
If I press the button long enough, I do get the event with event value 11
Otherwise I get 10.
This task was configured like in your screenshot.
Code: Select all
9763152: SW : GPIO=0 State=0 Output value=1
9763161: EVENT: sw1#State=1
9763352: SW : GPIO=0 State=1 Output value=0
9763361: EVENT: sw1#State=0
9765352: SW : LongPress: GPIO= 0 State=1 Output value=10
9765361: EVENT: sw1#State=10
9772452: SW : GPIO=0 State=0 Output value=1
9772461: EVENT: sw1#State=1
9774452: SW : LongPress: GPIO= 0 State=0 Output value=11
9774461: EVENT: sw1#State=11
9775952: SW : GPIO=0 State=1 Output value=0
9775961: EVENT: sw1#State=0
9777952: SW : LongPress: GPIO= 0 State=1 Output value=10
9777961: EVENT: sw1#State=10
Otherwise I get 10.
Re: Long press for Button problems?
yes, this was checked and I disabled it and (good Idea ) after looking into the log... I see the Event Taster1#Switch=10Do you have some setting on the Tools->Advanced page to reorder events (next to the rules cache checkbox)
If you have it, make sure to disable it. (not the cache, but reorder events)
In the current code, it is already removed as it does have quite a lot of side-effects.
but the Event was not captured in the Rules. (still does not work with on Taster1#Switch=10 do
Do you see the 11 (or 10) when looking at the Device Page? Or is this just for the Event trigger?
Any hints what disables the rule to catch the event?
Thanks again!
Edit for update:
update, I tried with a different Hardware and same SW Version and there it works with the Buttons double and long press catching in the Rules.
Strange thing!
so again, any hints what disables the rule to catch the event? Timing? Special characters from editing? Can it help if I clear the rules Page and edit again?
Thanks for your help
Re: Long press for Button problems?
OK, I found the issue
I already had a general check for the switch pressed on another Rules Page
on Taster1#Switch do
... some stuff
endon
unfortunately this was only LCD light on, so no unexpected effects...
this catched all button events. Changing it to
on Taster1#Switch=1 do
...some stuff
endon
works for the second value also
Did not realise that the event is matched only once. I rewrite my Butten routine in that way and I#m happy again
I wonder what was the reason tat it worked before, must have been a Rules change from me.
Never trust a user who has changed nothing except the release...
I already had a general check for the switch pressed on another Rules Page
on Taster1#Switch do
... some stuff
endon
unfortunately this was only LCD light on, so no unexpected effects...
this catched all button events. Changing it to
on Taster1#Switch=1 do
...some stuff
endon
works for the second value also
Did not realise that the event is matched only once. I rewrite my Butten routine in that way and I#m happy again
I wonder what was the reason tat it worked before, must have been a Rules change from me.
Never trust a user who has changed nothing except the release...
Re: Long press for Button problems?
A few months ago I did add caching to the rules.
This does keep track of which event is handled where in what rules file.
It does have a HUGE impact on performance, especially on ESP32 with a larger LittleFS filesystem as that's relatively slow in accessing files.
From roughly 3 - 5 events/sec to > 250 events/sec on my test setup (best case scenario, most of the time you will not be able to handle so many events/sec)
There was always some check on whether an event was handled, but this check wasn't perfect.
Glad you found it on your own
This does keep track of which event is handled where in what rules file.
It does have a HUGE impact on performance, especially on ESP32 with a larger LittleFS filesystem as that's relatively slow in accessing files.
From roughly 3 - 5 events/sec to > 250 events/sec on my test setup (best case scenario, most of the time you will not be able to handle so many events/sec)
There was always some check on whether an event was handled, but this check wasn't perfect.
Glad you found it on your own
Who is online
Users browsing this forum: No registered users and 118 guests