jimmy-landry / HA-Mobile-Dashboard-Config

A mobile Home Assistant dashboard inspired by LE0N's Rounded theme
52 stars 5 forks source link

INFO Sensor pending update #1

Closed barto95100 closed 1 week ago

barto95100 commented 2 weeks ago

HI, I view your video on youtube thanks for sharing your dashboard.

Question: how do you create the sensor pending_update ?

jimmy-landry commented 2 weeks ago

Go to Settings > Devices & Services > Helpers and create a new template sensor. Name it "Pending Updates Counter." In the value template, you'll want to create a template that adds to a variable each time it sees an update sensor in the 'on' state. Like this:

{% set total = 0 %}
{% if is_state('update.home_assistant_core_update', 'on') %}
  {% set total = total + 1 %}
{% endif %}
{% if is_state('update.home_assistant_supervisor_update', 'on') %}
  {% set total = total + 1 %}
{% endif %}
{% if is_state('update.home_assistant_operating_system_update', 'on') %}
  {% set total = total + 1 %}
{% endif %}
{{ total }}

Each add-on exposes an update sensor as well so if you want those to be accounted for you'll need to copy/paste the if statement for each of those as well. Hopefully that makes sense 😀

barto95100 commented 2 weeks ago

Ok i understand :)

maybe this is the same :


{{ states.update
             | selectattr('entity_id', 'match', 'update.*')
             | selectattr('state', 'eq', 'on')
             | list
             | length }}
jimmy-landry commented 1 week ago

Works on my end 👍