-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
Improve existing and add new persistence filters #3642
Conversation
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
While you are at it, does it make sense to add a range filter? Ignore all values that are above/below a min/max range for filtering out obviously bogus sensor readings. That's a common use case. One could argue that would best be applied in a profile I'll concede. |
Signed-off-by: Jan N. Klug <[email protected]>
Signed-off-by: Jan N. Klug <[email protected]>
Signed-off-by: Jan N. Klug <[email protected]>
It is accessible from the add-on settings page and has both a design and a code tab. The design tab allows to set persistence strategies for Items, define cron strategies and set the default strategies. It does not duplicate names for (cron) persistence strategies and duplicate configs for the same set of Items. The code tab also allows to also specify treshold and time filters and needs minor adjustment once openhab/openhab-core#3642 is merged code completion is not provided. Signed-off-by: Florian Hotze <[email protected]>
It is accessible from the add-on settings page and has both a design and a code tab. The design tab allows to set persistence strategies for Items, define cron strategies and set the default strategies. It does not duplicate names for (cron) persistence strategies and duplicate configs for the same set of Items. The code tab also allows to also specify treshold and time filters and needs minor adjustment once openhab/openhab-core#3642 is merged code completion is not provided. Signed-off-by: Florian Hotze <[email protected]>
It is accessible from the add-on settings page and has both a design and a code tab. The design tab allows to set persistence strategies for Items, define cron strategies and set the default strategies. It does not duplicate names for (cron) persistence strategies and duplicate configs for the same set of Items. The code tab also allows to also specify threshold and time filters and needs minor adjustment once openhab/openhab-core#3642 is merged code completion is not provided. Signed-off-by: Florian Hotze <[email protected]>
It is accessible from the add-on settings page and has both a design and a code tab. The design tab allows to set persistence strategies for Items, define cron strategies and set the default strategies. It does not duplicate names for (cron) persistence strategies and duplicate configs for the same set of Items. The code tab also allows to also specify threshold and time filters and needs minor adjustment once openhab/openhab-core#3642 is merged code completion is not provided. Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Jan N. Klug <[email protected]>
Signed-off-by: Jan N. Klug <[email protected]>
It's easy from code, the question is as @rkoshak already pointed out: is this something that should be done for persistence or is it more something for a profile? If you think it's useful as persistence filter, then I can add it. |
I personally would consider it useful, because I often see the situation that bogus sensor values get persisted and there is no easy way to clean up persisted data afterwards. So if it is easy to implement and nobody vetos - why not add it. |
I thought of a case that can only be solved as a persistence filter. What if you have a sensor where you do want to process errant readings in a rule (e.g. send an alert, take remedial action, etc.) but do not want to persist the data? If you used a profile you can't do that but as a persistence filter you can. (Or in a rule of course with the persist() action. And it probably deserves it's own issue, but periodically users lament the fact that the persistence config doesn't allow something like "everything but". If I had two Items I don't want to be persisted but want all the rest to be, I have to include all the rest in the config instead of just the two to exclude. That's not an easy change I suspect but is it something worth opening another issue for? |
Signed-off-by: Jan N. Klug <[email protected]>
Feel free to open one. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
It is accessible from the add-on settings page and has both a design and a code tab. The design tab allows to set persistence strategies for Items, define cron strategies and set the default strategies. It does not duplicate names for (cron) persistence strategies and duplicate configs for the same set of Items. The code tab also allows to also specify threshold and time filters and needs minor adjustment once openhab/openhab-core#3642 is merged code completion is not provided. Signed-off-by: Florian Hotze <[email protected]>
Closes #1463. Refs openhab/openhab-core#2871. Refs openhab/openhab-core#3642. It is accessible from the add-on settings page and has both a design and a code tab. The design tab allows to set persistence strategies for Items, define cron strategies and set the default strategies. It does not duplicate names for (cron) persistence strategies and filters as well as configs for the same set of Items. All four filters provided by openHAB core (treshold, time, equals/not equals, include/exclude) can be configured. When the user removes a cron strategy or a filter, it is automatically removed from all configs so that there is no API failure (400 Bad Request). No code completion is not provided, but required attributes for filters are automatically set on save to avoid API failure (500 Internal Server Error). A few words about order and sorting: - openHAB Core seems to sort the cron strategies. - Configurations itself are unsorted, they could be sorted alphabetically by the UI. - Items of configuration are sorted by their type (groups before normal Items) as well as alphabetically. -- Signed-off-by: Florian Hotze <[email protected]> Co-authored-by: J-N-K <[email protected]>
* Improve existing and add new persistence filters * include filter Signed-off-by: Jan N. Klug <[email protected]> GitOrigin-RevId: d64bd3b
#2871 introduced working persistence filters base on time and threshold, but since they were never documented, I doubt they have been used at all.
This PR changes is API breaking because it changes the filter definitions in
persistence.xtext
but this will probably not be noticed at all. It also adds two new persistence filters: "Equals" and "NotEquals" that can be used to allow/disallow a certain set of values.Filters can be defined by
and be applied with
I'll add documentation in the next few days.