I am using oh3 RC1-2 and have startet to work with quantityTypes instead of unitless Numbers.
I have two Items defined as Number:Volume and the following rule to calculate my daily water consumption:
var test = Wasserzaehler_ZaehlerstandLiter.deltaSince(now.withHour(0).withMinute(0).withSecond(0))
But I get the following error:
2020-12-15 18:06:35.591 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘wasserverbrauch_taeglich’ failed: class org.openhab.core.library.types.QuantityType cannot be cast to class org.openhab.core.library.types.DecimalType (org.openhab.core.library.types.QuantityType and org.openhab.core.library.types.DecimalType are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @10739cb2)
I think it is a problem of the quanitiyTypes but I have no idea how to handle this.I tried different ways to define the variable but without success.
Can someone point my in the right direction?
Which persistence service do you use? Default: RRD4J? The description of your issue sounds like a minor bug in
PersistenceExtension.deltaSince() method. There seems to be a wrong type conversion when the persistence returns a
QuantityType value. I will have a look.
Can you amend your configuration of the two Items - if possible? Or did you create them via UI?
I have created them via UI. I use RRD4J.
If you need more Information feel free…
Thank you for your help!
Thanks for your report. I think I already figured the root cause and prepared a fix for it.
Awesome, so I have to switch to the snapshot builds… can you inform me when it is solved and in a new version.
Other question: I assume that my rule should work for normal case?
Thank You for the quick reply and help!
Fix is merged: https://github.com/openhab/openhab-core/pull/1939
Will be in snapshots starting from tomorrow.
Thank you guys!!! Works like a charm!!!
I assume you already answered this question on your own. I am glad it is working now. Thanks for the feedback and testing.
I thank you for all your work!!!
I had to add a Number.
var Number test