Change in timer event? Rules not working after upgrade

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
martinus
Normal user
Posts: 129
Joined: 15 Feb 2020, 16:57

Change in timer event? Rules not working after upgrade

#1 Post by martinus » 27 Jan 2021, 15:46

After upgrading the first unit (ESP32 M5Stack) from 20200410 to 20210114, i've noticed that the display no longer updates the content.
Checking events, noticed that the event is now "Rules#Timer=1,1"

What's the second parameter about? Readthedocs does not mention anything about this change in the rules section


This rule section no longer works:

Code: Select all

on Rules#Timer=1 do
  TimerSet 1,30
  m5lcdcmd clear
  m5lcdcmd color,CYAN
  m5lcd 20,70,2,%systm_hm%
  m5lcdcmd color,GREEN
  m5lcd 0,140,1,In
  m5lcdcmd color,YELLOW
  m5lcd 90,140,2,[var#1#D2.1]
  m5lcdcmd color,GREEN
  m5lcd 0,210,1,Out
  m5lcdcmd color,YELLOW
  m5lcd 90,210,2,[var#2#D2.1]
endon

User avatar
Ath
Normal user
Posts: 3519
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Change in timer event? Rules not working after upgrade

#2 Post by Ath » 27 Jan 2021, 16:09

If you have a look at the LoopTimerSet (and LoopTimerSet_ms) docs you'll see the extra argument documented, but indeed it hasn't been updated for TimerSet/TimerSet_ms commands.
/Ton (PayPal.me)

martinus
Normal user
Posts: 129
Joined: 15 Feb 2020, 16:57

Re: Change in timer event? Rules not working after upgrade

#3 Post by martinus » 27 Jan 2021, 16:23

Alright, so we have auto repeating added, with the loop count as secondary parameter.

Nice, but for some reason the "On Rules#Timer=1 do" is no longer matching the event on my upgraded unit.

User avatar
Ath
Normal user
Posts: 3519
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Change in timer event? Rules not working after upgrade

#4 Post by Ath » 27 Jan 2021, 16:35

Hm, timers have been working for me, and I'm usually running current mega, so not sure why it's not working for you.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8754
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Change in timer event? Rules not working after upgrade

#5 Post by TD-er » 27 Jan 2021, 19:26

Hmm that's rather strange, as the event matching should allow for early termination in the match.
Maybe I messed up in there.

That's for sure one thing that was not tested by me as I never thought of it to test.

martinus
Normal user
Posts: 129
Joined: 15 Feb 2020, 16:57

Re: Change in timer event? Rules not working after upgrade

#6 Post by martinus » 27 Jan 2021, 19:43

I've also made some customizations to the stock rulematch function, but that only deals with wildcard processing. And it has worked fine on the april-2020 version of ESPEasy.
But maybe some of my changes prevent the current version from functioning properly.
If the new timers events work on stock versions, it must be my bad...

When i change the rule to '"On Rules#Timer=1,1 do" it works but that looks rather silly. As if it does a full string based compare somehow...

TD-er
Core team member
Posts: 8754
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Change in timer event? Rules not working after upgrade

#7 Post by TD-er » 27 Jan 2021, 23:47

As far as I know it is working fine on the normal builds as nobody reported issues so far and it has been mentioned as example in the docs.

TD-er
Core team member
Posts: 8754
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Change in timer event? Rules not working after upgrade

#8 Post by TD-er » 02 Feb 2021, 14:28

Sorry Martinus, there was a bug in the timer parsing...
See https://github.com/letscontrolit/ESPEasy/pull/3486

In short, a leading 0 was discarded as a valid integer and thus "20:01:02" would be parsed as "20:0:0" so you would run into lots of issues here.
Even worse, if you had morning hours with a leading 0.

The timer events should still work, but please let me know if you still run into issues.

Post Reply

Who is online

Users browsing this forum: No registered users and 120 guests