Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dear,
As discussed in this issue I have integrated filtrex expressions into the Sensor node config screen.
Note that I have included version filtrex version 3.0.0-rc11 as a dependency. That is a release candidate version, but the author has planned the final 3.0.0 version in the near future. I needed that version because the author has been so kind to implement boolean values and nested expressions for us. So you can now use for example "msg.payload == true", similar to the current dropdown value in this node...
Note that this pull request determines (based on the input message) whether the expression is true or false, but that value is NOT used to filter messages for alarms. Reason why I haven't implemented that in this pull request, is that it is also not implemented yet (see here). Moreover I don't know if/how you want to implement my other feature request. Because when that would be implemented, the message always has to be processed (but the filtrex expression result value would only be used to determine whether an alarm should be triggered or not). So I propose to keep that for a separate discussion...
This pull request also offers an extra server-side endpoint, which can be called by the frontend (config screen in flow editor) to do some (basic) real-time syntax checking:
I have tried to make sure that existing nodes are not impacted, by automatically converting the old dropdown values to corresponding filtrex expressions in the following situation:
If you would like to test this backwards compatibility, the easiest way to do it is by adding a bunch of sensor nodes on the flow (when still using the old version). Then install the new version, and test the old nodes in the above described two scenarios....
Hopefully you like it, because it was quite some work to implement it.
Thanks for reviewing !!
Bart