Notification when updates are pending

Inspired by Smart home junkie’s recent video about automatically updating ESPhome devices & realising that I have sometimes left HA core/OS updates sitting unactioned for a few weeks. I tried to cobble together an automation that would perform a daily check and send a notification for any pending system updates.

The automation below seemed to work when I tested it the other day with 4 pending updates. Today I see an update to HA core but the automation hasn’t run since it was tested. when I evaluate the condition it says it doesn’t pass

I assume I have something wrong in the template?

 alias: Notify - updates available
 trigger:
   - platform: time
     at: "04:55:00"
 condition:
   - condition: template
     value_template: >-
       {{ states.update | selectattr('state','eq','on') |
       map(attribute='entity_id')|list}}
 action:
   - service: notify.mobile_app_grant_nord2
     data:
       message: >-
         Updates available - {{ states.update | selectattr('state','eq','on') |
         map(attribute='entity_id')|list}}
       title: Home Assistant
 mode: single
   {{ states.update | selectattr('state','eq','on') | list | count > 0 }}
1 Like