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))
postUpdate(Wasserzaehler_Verbrauchtaeglich, test)
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.
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?
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?