Getting the latest released HA docker image version

Hi,

I’ve recently been trying to make my upgrade process more efficient; in doing so I’d like to check as part of my automation what is the latest released docker image in docker hub, I’ve managed to get it in a JSON form :

https://registry.hub.docker.com/v1/repositories/homeassistant/home-assistant/tags

Which gives me a ready-to-work-on JSON. How do I store the latest released build (in my case 0.80.3) in an HA sensor (probably through the RestFul sensor component) ?

Thanks in advance

command line sensor

curl -s https://registry.hub.docker.com/v1/repositories/homeassistant/home-assistant/tags | jq '.[].name' | sort -r | sed "4q;d" | sed -e 's/^"//' -e 's/"$//'

1 Like

Check out this custom component:

1 Like

How would that help me in getting the latest docker image version ?

Thanks, need to figure out now how to integrate it in the HASS docker container

I ended up using a rest sensor since running on docker I don’t have JQ installed :slight_smile:

- platform: rest
  name: Home Assistant Docker Latest Image Build
  scan_interval: 300
  resource: https://registry.hub.docker.com/v1/repositories/homeassistant/home-assistant/tags
  headers:
    Content-Type: application/json
    User-Agent: Home Assistant REST sensor
  value_template: >-
        {% for image_build in value_json | reverse if image_build.name.split(".")[0]=="0"  %}
          {% if loop.first %}
               {{image_build.name}}
          {% endif %}
        {% endfor %}

Just to follow up on this… I tweaked this to omit any builds that contain the letter “b”. So currently this should only include stable releases.

---
- platform: rest
  name: docker_lastest_build
  scan_interval: 300
  resource: https://registry.hub.docker.com/v1/repositories/homeassistant/home-assistant/tags
  headers:
    Content-Type: application/json
    User-Agent: Home Assistant REST sensor
  value_template: >-
    {%- for image_build in value_json | reverse if image_build.name.split(".")[0]=="0" and "b" not in image_build.name.split(".")[2] -%}
      {%- if loop.first -%}
        {{ image_build.name }}
      {%- endif -%}
    {% endfor %}
2 Likes

Thanks for that,

I’m still using the one with the beta builds to track the progress of builds on docker hub, but your approach has benefits as well of course

1 Like