Closed mherwege closed 1 month ago
We only can return a Quantity or provide the unit, if openHAB core provides it, but it currently does not, see https://www.openhab.org/javadoc/latest/org/openhab/core/persistence/extensions/persistenceextensions.
Indeed. I will open a core issue.
Solved with https://github.com/openhab/openhab-js/pull/331
I have following code (generated by Blockly, but that is not relevant in the context):
PVETotalGS1
andPVETotalGS2
are both Number:Energy items.for
history.historicState
a state is returned, which can then be used for Quantity calculations in line 4.history.deltaSince
return a numeric (not a QuantityType), so I had to explicitely attach the unit. To be consistent, it would be more logical to return a Quantity Type instead for this function as well.The same argument would apply to other history functions.