-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
[persistence] Persistence filter not accepting units of measure #4625
Comments
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/persistance-filter-not-accepting-uom/162764/14 |
@openhab/core-maintainers - I believe this issue belongs in core, can someone move it there? |
How do I do that? :) |
It's transferred now. |
@mkroch Can you try:
Looking at the code, it expects a String for the unit, and a String needs to be in quotes. If that solves the issue, a documentation change may be needed. |
Using either double or single quotation solves the problem - at least the *.persist file is accepted with no errors and I haven;t observed undesirable behaviour overnight. If the description is to be changed, would be nice to clarify that "°C" not "C" is needed. I don;t have kelvin sensors but it seems that "K" instead of "°K" is appropriate.
I will observe further and if no undesirable ivents occur will close that topic maked "Solved". Thank you for quick help. |
In OH 4.3.3 in jdbc.persistance file, I have pasted following filter (based on documentation exapmle @ https://www.openhab.org/docs/configuration/persistence.html):
Filters { temp_sanity : [] -100 200 C }
After save, log shows:
Configuration model ‘jdbc.persist’ has errors, therefore ignoring it: [11,1]: mismatched input ‘}’ expecting ‘:’
The same problem is when I change “C” to "°C" or “K” and so on. When not using units of measure I get a following error in log:
2025-02-28 09:06:48.916 [WARN ] [ence.filter.PersistenceIncludeFilter] - Cannot compare 5.03125 °C to range -100 - 200
At first I thought that, as mentioned above, the documentation might be wrong because it not only says that UoM in presistance filter are accepted (and uses them in examples) but stresses that they should be used:
In case of dimensional items (e.g Number:Temperature) a unit MUST be provided.
But then no fillter is possible since comparison cannot be made.
I did contact the community (https://community.openhab.org/t/persistance-filter-not-accepting-uom/162764/6) and was directed here.
Expected Behavior
My intention was to include in database recording only readings of Number:Temperature item that are in the specified range. This way I could exclude readings that are abnormal like -1000°C which I occasionally receive due to sensor hardware connectivity issues.
Current Behavior
Everything apart of the above works fine.
Possible Solution
Is it a bug?
Steps to Reproduce (for Bugs)
I am using oh on Ubuntu. Presistance is mariadb via jdbc. Checked it with rrd4j and it looked the same
Your Environment
I am using 4.3.3 oh on Ubuntu. Presistance is mariadb via jdbc. Checked it with rrd4j and it looked the same. The issue arouse while using oh 4.3.2 update to 4.3.3. did not help apart of the fact that persistance filter started accepting negative values (as mentioned in #4400 ).
The text was updated successfully, but these errors were encountered: