Custom-sidebar: manage Home Assistant's sidebar items per user or device basis

ha, right, yes that is mine.
funny to see my configuration being applied elsewhere :wink:

well what can I say, its a sensor that counts the number of alerts I set in my config, nothing more.

It’s probably not helpful to c&p my sensor, as it really is tailor-made to my needs.

Use case here: that counter also triggers a conditional card showing those alerts in the view. So I have the number in the Header Menu title, and the actual alerts in the view, in case action is required for me to take care of the alerts.

I can give you the state of the marquee_alerts":

template:

  - sensor:

      - unique_id: marquee_alerts
        state: >
          {{states('sensor.alerts_notifying')|int(0)}}
        icon: >
          mdi:{{'check' if is_state('sensor.alerts_notifying','0') else 'alert'}}-circle
        attributes:
          marquee: >

and that as you can see uses another sensor:

      - unique_id: alerts_notifying
        state: >
          {{label_entities('alert')|select('is_state','on')|list|length}}
        icon: >
          {% set count = this.state|int(0) %} mdi:numeric-{{count}}-box
        attributes:
          message: >-
            {% set alerts = expand(label_entities('alert'))|selectattr('state','eq','on')
               |map(attribute='name')|list %}
            {% set count = alerts|count %}
            {%- if count == 0 -%} Ok, geen alerts, alles is in orde
            {%- elif count == 1 -%}{{count}} Alert voor: {{alerts[0]}}
            {%- elif count == 2 -%}
              {{count}} Alerts voor: {{alerts[0]}} en {{alerts[1]}}
            {%- else -%}
              {{count}} Alerts voor: {{alerts[:-1]|join(', ')}}, en {{alerts[-1]}}
            {%- endif %}

the attributes of the marquee_alerts is rather complex, as it creates a string (for the Marquee…) of all relevant alerting alerts

In real life:

Mar-13-2025 10-10-49

guess what the repair is about…

taking care of that update fixes the repair, resets the counter and normalizes the Menu header, since no more pending alerts

1 Like