Home Assistant update notifications

For whatever reason the builtin updater.updater sensor doesn't seem to trigger notifications for me. So I built my own..

The sensor is as follows:

  - platform: rest
    name: ha_docker_version
    resource: 'https://registry.hub.docker.com/v2/repositories/homeassistant/home-assistant/tags'
    value_template: >-
      {% set results = value_json.results %}
      {%-set res-%}
      {%-set pipe = joiner('|')-%}
      {% for result in results if not result.name |regex_search("[a-z]",ignorecase=TRUE) -%} 
        {{ pipe()}}{{result.name}}      
      {% else %}        
        -1 
      {% endfor -%}
      {% endset -%}
      {% set res = res.split('|')|list -%}
      {{res[0]}}
    scan_interval: 1800  

The automation is as follows:

- alias: 'Update Available Notifications'
  trigger:
    - platform: template
      value_template: >
        {{ states.sensor.ha_docker_version.state > states.sensor.current_version.state }}
  action:
    - service: notify.notify_tzvi
      data_template:
        title: '*Update Available ({{ states.sensor.ha_docker_version.state }})!*'
        message: 'Time to update Home Assistant!'

And in Lovelace I have the following card:

 - type: entities
   title: "Home Assistant Versions"
   entities:
     - entity: sensor.current_version
       name: Current Version
     - entity: sensor.ha_docker_version
       name: DockerHub Version

Just to note, I use HA in Docker, so the sensor check the Docker registry for updates. Additionally, you'll need to have your notification component setup as well.

The code was compiled from the Home Assistant forums.