NSPanel Lovelace UI Cards (part 3/5, v0.9)

logo

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.

The required 5 libraries are:

All installed libraries need to have the same version number!

Blocks

For some description of the individual blocks of this library have a look in the online documentation.

Changelog

Version 0.9

  • modified colorwheel. Now returns color instead of position.

Version 0.8

  • fixed various selector issues
  • finally got shutter returnValue right
  • added page reload helper

Version 0.7

  • added option to hide the unit in cardThermo
  • fix for missing timerName, triggered error on direct call of some cards

Version 0.6

  • enhancement: changed returnValue uppercase for cardShutter to be compatible with openHAB shutter item
  • cleanup: moved fullpage Notification to Cards
  • bugfix: context Usage for next Statement was broken in ‘ForceContextForScript’
  • enhancement: modified context handling to prevent usage on non-Card statements (stuck on screensaver)
  • enhancement: added helpers to modify all callback settings on-the-fly

Version 0.5

  • fix for broken refresh timers (since 0.4)
  • improved context usage of ‘start with forced context’-helper

Version 0.4

  • improved multi-hardware-panel usage (not backwards compatible)
  • added feature to start on same page after leaving screensaver
  • added refresh on hardware button press
  • start screensaver if no startup action is given on callback
  • various bugfixes

Version 0.3

  • improved popupPage handling
  • returnValue of Entitiy Selector modification
  • added support for OpenWeatherMap Icons

Version 0.2

  • added documentation
  • initial realease

Version 0.1

  • pre-release

Resources

nspanel_cards.yaml

3 Likes

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();
              }
            }

Hi Tuny,

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.

Best regards, Rene

1 Like

Yes. It is working. Thank you very much.

Hi Tuny,

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.

Best regards, Rene

Same problem here, and your fix really fixed it. But it is line 1930 now. Which raises the question if this change made it into Github. :slight_smile:

Hi @Roi ,

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
 :slight_smile:

All the best for the new year,
regards, Rene