Alternative for Persistent Notifications in Lovelace (New sidebar in 0.96)

This is an alternative for showing up persistent notifications if you want to hide the new upcoming sidebar in 0.96.

We need some custom integrations and plugins. I think if you have a dashboard with LL, most of them are already installed.

  • Compact Custom Header to hide the new sidebar.
  • Browser Mod to show a popup with a service call.
  • Home Feed Card to show and dismiss the persistent notifications. You need the latest beta if you’re on 0.96.x
  • Button Card to have a nice button. Should also work with the core entity button.

They can all be installed via HACS. Thanks to the developers!

A template sensor with the count of the notifications

sensor:
  - platform: template
    sensors:
      pn_count:
        value_template: "{{ states.persistent_notification | length }}"

HA will throw a warning on startup that the sensor will only update manually, so we make an automation to update it.

automation:
  - alias: persistent_notification_update
    initial_state: true
    trigger:
      - platform: event
        event_type: call_service
        event_data:
          domain: persistent_notification
          service: create
      - platform: event
        event_type: call_service
        event_data:
          domain: persistent_notification
          service: dismiss
    action:
      - service: homeassistant.update_entity
        entity_id: sensor.pn_count

Now all we need is a nice button to show up in one of our LL views.

  - type: custom:button-card
    entity: sensor.pn_count
    color: grey
    icon: mdi:bell-outline
    show_name: false
    show_label: true
    label: >
      [[[ return 'PN (' + states['sensor.pn_count'].state + ')' ]]]
    tap_action:
      action: call-service
      service: browser_mod.command
      service_data:
        command: popup
        title: Persistent Notifications
        card:
          type: custom:home-feed-card
          show_empty: false
          show_notification_title: true
        deviceID:
          - this
    state:
      - value: 0
        operator: '>'
        color: orange

20190715_13%3A05%3A45_001 20190715_13%3A04%3A38_001
A click at the button opens the Home Feed card in a popup, where you can dismiss the notifications.
20190715_13%3A05%3A19_001
Have fun!

5 Likes

Is 0.96 out ?

I don’t see it. This thread surprised me too, thought I missed a release.

It has not been publicly released yet, however the betas are always available a week or so before the main release.

1 Like

I don’t see any way in CCH to hide the new sidebar. It’s also unclear how the various ingress frames, iFrames, dev-tools are accessible if you do this?

EDIT: I see you can hide it now but how then to access the dev-tools and other frames?

It’s for a tablet as a dashboard where users should not access those items.
On my PC i have no problem with the sidebar.

ah ok… but how do you turn off the sidebar only for a tablet? and can it be done only for one view? I guess not…

You can do this with CCH exceptions.

  exceptions:
    - conditions:
        user: TPad
      config:
        disable_sidebar: true
        menu: overflow
        options: clock
        background: rgba(38, 49, 55, 0.8)
        active_tab_color: "var(--primary-color)"
        clock_format: 24
        clock_date: false
        #date_locale: de-de
        hide_tabs: 0,1,2,3,4,5,6,7,8,9,10,11

So user TPad can’t see some tabs and the sidebar is hidden.
https://maykar.github.io/compact-custom-header/Exception-Config/

But not disable the sidebar for only one view/tab?
I guess it’s just screwing up my weather card and I’d like to disable the sidebar for just that one tab. I’m currently fixing the width and using the layout card with panel view just for that view so it displays in 2 columns not 3 (setting the width to 350px) but it’s not ideal.

That’s not possible i think.

1 Like

Wanted to add that you could take this one step further with CCH. Even though the notifications button is no longer customizable, you can still use “notifications” as an entity in your conditional styling. So, you could make a tab devoted to notifications and have it only show when there are notifications.

The notifications “entity” returns the number of notifications

cch:
  conditional_styles:
    - entity: notifications
      condition:
        state: 0
      tab:
        4:
          hide: true

or with a template:

cch:
  conditional_styles:
    template:
      - tab:
          4:
            display: >
              if (notifications) "show";
              else "hide";
1 Like

Yeah, that was my first idea too, but i like the popup with the notifications more.
Maybe it’s possible to show a tab, aligned right that can call a service in the future? :slightly_smiling_face:
Then it will be most like before.
Thanks for your suggestion.

1 Like

Thanks for the idea and the initial setup!

I used the Popup Card instead of the Browser Mod because i already have multiple Popup Cards working.

Looks great!
image

1 Like

Is it possible that

sensor:
  - platform: template
    sensors:
      pn_count:
        value_template: "{{ states.persistent_notification | length }}"

no longer works. Everything worked fine up to HA version 2023.4.6. From version 2023.6.1 always seems to come as number: 0

From the 2023.6.1 Release Notes:
20230615_093957