-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
[Rules] Enhancement: add %eventvalue<nr>% #219
Comments
And for all events that receive multiple values, like current Rules#Timer events that now have The current limit in ESPEasy is 4 event values, and |
Not sure if that remains a hard limit as it used to be related to the number of task values. |
Support added at commit c679a2e |
Seems to work (at least for me). Same rules with Thanks a lot, great work. |
Thanks for testing, should we close this issue now? |
IMHO yes... If something comes up you could always reopen it (or open a new one) with a more specific description of the problem... |
I have the following ruleset:
It seems it takes the last |
Interesting. But why dont you use this instead?
|
You're right, I could, but that's always the case, so And, if I did, I wouldn't have found this bug! 😀 |
Eventvalue1-4 only implemented to the user called own named events, as nothing else supports multiple eventvalues in RPIEasy. I am sure that "sht30" has no eventvalue, it has 4 named taskvalue. |
Honestly I have never used it, and i have no idea why to use at all. |
From ESPEasy manual: Event value (%eventvalue%) Rules engine specific: %eventvalue% - substitutes the event value (everything that comes after the ‘=’ sign, up to four values are possible). Sample rules section: on remoteTimerControl do |
Hmm... In ESPEasy it works like this. If a task has multiple values you can generate a
SHT30 has 2 values (temperature and humidity) which are named, sure... And I guess |
Than this is an undocumented feature.
The event name is "sht30#temperature" so it is a very interesting logic, as sht30#temperature has exactly on value = temperature |
first taskvalue hacked into eventvalue1 in commit 2ec5b36 |
In ESPEasy, events are queued, with the measured values of that moment in time in the |
Just updated with that latest commit and testing now... However I'm not sure if that's the right way to go. What about events that don't have a task associated? There it has to be made sure, that So IMHO instead of taking |
The |
Events without tasks has no real data in RPIEasy, and in the near future i do not plan to change this. Except with the timers, but they all have an own object in memory.
There are no such limit in python, it can be even a thousand length array. EventValues is a global array in RPIEasy which is filled with data at the same time when rule line is parsed. There are no direct link, just another lines of code added to the rule interpreter that slows down interpreting. :) |
In ESPEasy there are the Does your statement imply that the |
I know two types of events, either generated by the System or by the User. I mean above: events generated from the system has no more than 1 value or zero clumsy-stefan indicated that events generated by devices/system should have fill eventvalues with taskvalues also. And also referred "Events without tasks" that is something that i can not get. About user generated events: |
Eg. a PCFGPIO does not have to have a task associated, but if it's changed (input) it generates an event in ESPEasy. Like this you don't need to waste tasks for pure PCFGPIO inputs, but still get the changes as an event. Same as with timers, etc.
I think this changed also in ESPEasy, eg. the looptimer set 2 variables when it generates an event, see here at
|
Yes this is a good example, as i do not plan to code something like this. |
That's the main reason why I'm switching for very complex nodes from ESPEasy to RPIEasy, as the standard 24 tasks of an ESPEasy node is not enough. Happens very rarely but I do have one or two applications, where I need more GPIO/Sensors and the associated tasks. |
The idea of the event values is that these values will be appended to the event, not when parsing rules. For example a task does generate an event with the new value. A recent addition to ESPEasy is shown by @clumsy-stefan in a screenshot to let a task generate an event with all task values present as event values to be able to process less events and have them all present in a single event for example to generate an URL for posting all task values of a single task in one line. |
closed as implemented |
Just found another issue with When calling
Log:
The same seems to happen, if within an |
Yes, as taskvalueset command changes a task value, which will trigger a new event, every event writes the same EventValue array, which is global variable. I think this issue can be solved by deleting from Line 1155 to Line 1171 at commands.py |
Probably an event should have a kind of a unique "event-D" and the values assigned to that ID so it can be used again when returning from a recursion? |
That's why in ESPEasy the eventvalues and event are kept together. |
Just found another case where I have the following rule:
Now in the log I find the following:
As you can see, the event Obviously it works with |
FYI: just had a bit more log of above issue:
It seems that `%eventvalue% still has the value from the previous command (1.22 in this case, which was a sent value from another unit). Could also be some kind of race-condition or wrong sequence of assigning values. |
I think it may have to do with the event values not being stored along with the events when created. |
Just found another rule where the comparison seems to fail: Rule:
Log:
It can obviously be circumvented wtih an if statement, but I guess, that's not the idea... EDIT: I just realised if I remove the spaces before and after the |
Hmm that may also fail on ESPEasy, I think |
In newer ESPEasy versions you can use %eventvalue% to directly access the values of an event with multiple values. Used mainly to access variables of the new "Single event with all values" feature.
The text was updated successfully, but these errors were encountered: