github joseluis9595/lovelace-navbar-card v0.18.0
NavbarCard v0.18.0

latest release: v0.18.1
9 days ago

Media player improvements

This release brings two small additions to the new media player widget. We’ve added a new show field for finer control over widget visibility, along with support for JavaScript templates in the entity field of the media player (thanks @coolssor )

type: custom:navbar-card
...
media_player:
  show: |
    [[[
        const mediaPlayerState = states['media_player.test_media_player'];
        const lastChanged = new Date(mediaPlayerState.last_changed);
        const now = Date.now();
        const fiveMinutes = 5 * 60 * 1000;
      
        // Display media player if it's playing OR paused in the last 5 minutes
        return (
          mediaPlayerState.state == 'playing' ||
          (mediaPlayerState.state == 'paused' &&
            (now - lastChanged) <= fiveMinutes)
        );
    ]]]
  entity: |
        [[[
          const state = states['sensor.area_select'].state;
          let entity;

          switch (state) {
            case 'Office':
              entity = 'media_player.office';
              break;
            case 'Kitchen':
              entity = 'media_player.kitchen';
              break;
            case 'Main bedroom':
              entity = 'media_player.main_bedroom';
              break;
            case 'Living room':
              entity = 'media_player.living_room';
              break;
            default:
              // fallback if not in a room with a defined player
              entity = 'media_player.whole_home';
          }

          return entity;
        ]]]

Popup label fixes

This section doesn’t bring entirely new features, but it does include a few much-requested fixes for labels in popup items.

  • New background option: A new configuration option, show_popup_label_backgrounds, lets you toggle a visual change for how popup labels are rendered, addressing the issues on label readability for popup items (thanks again @coolssor):
release_popup_labels_background
  • Badge positioning fix: When using labels in popup items, the badge would sometimes appear on top of the text instead of on top of the icon. This has now been corrected:
release_popup_label_fix


All changes

  • Added show option for media_player.
  • Added support for JSTemplate in the entity field of media_player. Thanks @coolssor!
  • Fixed popup label badge positioning. (closes #139 )
  • Added option to display labels inside the popup item background: show_popup_label_backgrounds. Thanks @coolssor (closes #106 )


⭐ Support navbar-card

If you enjoy using navbar-card and want to support its continued development, consider buying me a coffee (or a beer 🍺), or becoming a GitHub Sponsor!

Buy Me A Coffee GitHub Sponsors

Your support means a lot and helps keep the project alive and growing. Thank you! 🙌

Don't miss a new lovelace-navbar-card release

NewReleases is sending notifications on new releases.