Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eventvalue parsing #4198

Closed
chemmex opened this issue Aug 14, 2022 · 2 comments · Fixed by #4204
Closed

eventvalue parsing #4198

chemmex opened this issue Aug 14, 2022 · 2 comments · Fixed by #4204
Labels
Category: Rules Related to the rule engine Type: Bug Considered a bug

Comments

@chemmex
Copy link

chemmex commented Aug 14, 2022

I'm not sure it's because of #4146, but zero-valued eventvalues are not parsed anymore in the latest release.

Tested on ESP_Easy_mega_20220809_normal_ESP8266_4M1M build

The rule triggers log record upon arrival of setctl command

on setctl do
	logentry,"All: %eventvalue0%, #1: %eventvalue1%, #2: %eventvalue2% #3: %eventvalue3%, #4: %eventvalue4%"
endon

If I send to the command topic the following payload:
event,setctl=1,2,3

the log shows

689929: EVENT: setctl=1,2,3
690049: ACT : logentry,'All: 1,2,3, #1: 1, #2: 2 #3: 3, #4: 0'
690051: All: 1,2,3, #1: 1, #2: 2 #3: 3, #4: 0

If I change the payload to

event,setctl=0,2,3

logentry is not triggered:

724681: EVENT: setctl=0,2,3

This affects only %eventvalue1%, all subsequent zero values are processed as expected

@TD-er
Copy link
Member

TD-er commented Aug 14, 2022

OK, this may indeed be related to this strip leading zeroes.
When parsing events, the first eventvalue must be a numerical and I think the stripping part may indeed mess things up here.

I was already a bit afraid this may become an issue and was tempted to add another checkbox to enable/disable this optimization.

@TD-er TD-er added Type: Bug Considered a bug Category: Rules Related to the rule engine labels Aug 14, 2022
@ghtester
Copy link

Please don't add the checkbox, the optimization (or a value translation) works fine except this particular case, where the first zero looks to be eaten by wrong test condition. Hopefully this could be fixed without complicating the settings page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Rules Related to the rule engine Type: Bug Considered a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants