Using openHAB 3.4-release.
I’m trying to get the value of an item without unit. That works with the current state, but not with an historic state?
var PVLeistung = items.getItem("KOS_PVPower").rawState.intValue();
var PVLeistung10Unit = items.getItem("KOS_PVPower").history.historicState(interval10mins);
var PVLeistung10 = items.getItem("KOS_PVPower").history.historicState(interval10mins).intValue();
console.log("current PV power: " + PVLeistung);
console.log("PV power 10 mins ago (UoM): " + PVLeistung10Unit);
console.log("PV Power 10 mins ago (Int): " + PVLeistung10);
this leads to:
2023-03-28 20:23:21.080 [INFO ] [ab.automation.script.ui.evccDetectEV] - current PV power: 0
2023-03-28 20:27:33.345 [INFO ] [ab.automation.script.ui.evccDetectEV] - PV power 10 mins ago (UoM): 0 W
2023-03-28 20:23:21.132 [ERROR] [b.automation.script.javascript.stack] - Failed to execute script:
org.graalvm.polyglot.PolyglotException: TypeError: (intermediate value).getItem(...).history.historicState(...).intValue is not a function
...
2023-03-28 20:23:21.148 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'evccDetectEV' failed: org.graalvm.polyglot.PolyglotException: TypeError: (intermediate value).getItem(...).history.historicState(...).intValue is not a function
How can I get an historicState without Units?