This is part 3 of a 5-part collection of blockLibraries to use the NSPanel with the Lovelace UI. Check out the online documentation about how to use this library.
Very nice libary! Its really fun and easy to use.
I tried with the newest milestone release (4.2.0.M3).
Everything looks good.
But the âCARD CHARTâ is not working.
I get this error:
2024-05-26 11:56:44.226 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID âa47f9cdc71â failed: org.graalvm.polyglot.PolyglotException: TypeError: undefined has no such function âhistoricStateâ
What could be the Problem here?
I think this is the source:
for (i = NumberOfValues - 1; i >= 1; i--) {
targetValue = parseFloat(items.getItem(item).history.historicState(time.ZonedDateTime.now()['minus'+OffsetUnit](i*Offset))?.state) * scaling;
if (type == 'cardLChart' && !targetValue)
continue;
dataset += '~';
if (type == 'cardLChart') {
dataset += String(NumberOfValues - i) + ":";
}
if (type == 'cardChart' && targetValue > MAX_VALUE_BY_DESIGN)
targetValue = MAX_VALUE_BY_DESIGN;
if (targetValue > maxValue) {
maxValue = targetValue;
}
dataset += String(Math.ceil(targetValue));
if (type == 'cardChart' && i % Math.floor((NumberOfValues / (NumberOfXLabels - 1))) === 0) {
dataset += '^-' + String(i*Offset) + OffsetUnit.substring(0,1).toLowerCase();
}
}
thanks for pointing to this issue. I donât have 4.2x running, but I can see in the openhab source code changes that historicState method has been removed since 4.2. As far as I can see it, history.historicState must be replaced with persistence.persistedState. Can you edit the file absorb-it:blockly:nspanel_cards in the Blocklibrary admin section (line 1868) and verify that this is working? Canât check this for now.
thanks for the feedback. Pushed some update to github, I will wait for further issues (and more testing time on my side) for some compatibility release.
thanks for bringing this up again. Itâ had found itâs way into github, but I did not released another version yet. Sorry, forgot about that, I will asapâŠ