Persistent notification for new HA versions, docker approved

Since I use docker I don’t get the fancy notification when new versions come out, so I rolled my own. It uses the rest platform to grab the latest version number from https://pypi.python.org/pypi/homeassistant/json every 15 minutes (900 seconds). It will send you one persistent notification anytime the latest version is different from your version.

First, you need to declare an input boolean:

input_boolean:
  version_checked:
    name: Version checked
    initial: off

Then create a couple of sensors:

sensor:
  - platform: rest
    resource: https://pypi.python.org/pypi/homeassistant/json
    name: Latest version
    scan_interval: 900
    value_template: >-
      {% set ver = value_json.info.version | trim() %}
      {% if (ver | regex_match('^(?!\s*$)[0-9|.\s]*$')) %}
        {{ver}}
      {% else %}
        unavailable
      {%endif%}

  - platform: version
    name: Current version

Last, the automations to tie the room together:

automation:	  
  - alias: Latest version updated
    initial_state: false
    trigger:
      - platform: state
        entity_id: sensor.latest_version
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.version_checked

  - alias: Check New Version
    trigger:
      platform: time_pattern
      minutes: '/15'
    condition:
      condition: and
      conditions:
        - condition: template
          value_template: "{{ states('sensor.current_version') != states('sensor.latest_version') }}"
        - condition: template
          value_template: "{{ states('sensor.latest_version') != 'unavailable'}}"
        - condition: state
          entity_id: input_boolean.version_checked
          state: 'on'
    action:
      - service: input_boolean.turn_off
        entity_id: input_boolean.version_checked
      - service: persistent_notification.create
        data_template:
          message: "{{states('sensor.latest_version') | string }} is available for download" 
          title: 'Update available'

Interesting
I use the bog standard scrape component and HA’s own example for this.
It does tell me when a new version of HA is released, but does not tell me when the docker version is available, so a pre-warning I suppose…
I’d love to retrieve this from HERE but not yet managed to figure out how

I stole the idea from here, but just added the automation for the notification.