Updating HA/Hass.io, checking for available versions and managing updates

It is exactly that.
I am trying to update my Hassio back again , checking for available versions to do so and manage updates in the various available methods.

Managed to get back to 0.61 via the Curl command but it won’t update to 0.61.1 like that or the Hassio updater.

I use the following to ascertain current version of Hass.io (running on a RPi3), and the latest available version, and then to send an alert when a new version is available. Please note that this works for the release of Hass.io updates, and not for the general release. I think that is what people were asking for was it not?

##sensors.yaml file
- platform: rest
  resource: https://raw.githubusercontent.com/home-assistant/hassio/dev/version.json
  name: HA Latest Version
  value_template: '{{ value_json.homeassistant }}'

- platform: version
  name: HA Installed Version

- platform: template
  sensors:
    ha_update_available:
      friendly_name: 'HA Update Available'
      value_template: >-
        {%- if states.sensor.ha_latest_version.state != states.sensor.ha_installed_version.state -%}
           Yes
        {%- else -%}
           No
        {%- endif -%}
      icon_template: >-
        {%- if states.sensor.ha_latest_version.state != states.sensor.ha_installed_version.state -%}
          mdi:alert-box
        {% else %}
          mdi:approval
        {% endif %}

## automations.yaml
- alias: Update Notification
  action:
  - data:
      message: "New Home Assistant version {{ states.sensor.ha_latest_version.state}}\
        \ is available for download.\r\n\r\nYou are currently running {{ states.sensor.ha_installed_version.state}}.\r\
        \n\r\nhttps://home-assistant.io/blog/categories/release-notes/"
      title: New Home Assistant version
    service: notify.my_email
  condition: []
  id: '1515492307283'
  trigger:
  - entity_id: sensor.ha_update_available
    from: 'No'
    platform: state
    to: 'Yes'
2 Likes

A couple of false positives over the last 48 hours, caused by the REST sensor returning “unavailable” for one reason for another (could be my internet connection or the webpage itself … not really sure). Updated the template sensor for “HA Update Available” to check for this.

- platform: template
  sensors:
    ha_update_available:
      friendly_name: 'HA Update Available'
      value_template: >-
        {%- if states.sensor.ha_latest_version.state != "unavailable" and states.sensor.ha_latest_version.state != states.sensor.ha_installed_version.state -%}
           Yes
        {%- else -%}
           No
        {%- endif -%}
      icon_template: >-
        {%- if states.sensor.ha_latest_version.state != "unavailable" and states.sensor.ha_latest_version.state != states.sensor.ha_installed_version.state -%}
          mdi:alert-box
        {% else %}
          mdi:approval
        {% endif %}
1 Like

Yeah this was also driving me crazy - the notifications - so I had already added that condition to my notifications. Thanks for this though. Works great.

… and back to the drawing board on this one.

Due to the way updates are not being “staged” to be betas for a week before becoming “stable” releases, my sensors are reporting a new version when there in fact is no update.

Current sensor is returning 0.66.0.b2 when the latest hassio stable release is in fact 0.65.6

same but I fixed it with a new condition in my automation (to turn off the notifications). You can amend the sensor in config l guess.

- alias: Update Available
  trigger:
  - entity_id: sensor.hass_current_version
    platform: state
  condition:
  - condition: template
    value_template: '{{ states.sensor.hass_current_version.state != "unavailable"
      and "b" not in states.sensor.hass_current_version.state and states.sensor.hass_current_version.state
      != states.sensor.hass_installed_version.state }}'
  action:
  - data:
      message: Home Assistant {{ states.sensor.hass_current_version.state }} is now
        available
      title: Home Assistant Update
    service: notify.notify
2 Likes

Great idea. I modified my template sensor to look as follows:-

- platform: template
  sensors:
    ha_update_available:
      friendly_name: 'HA Update Available'
      value_template: >-
        {%- if states.sensor.ha_latest_version.state != "unavailable" -%}
          {%- if states.sensor.ha_latest_version.state != states.sensor.ha_installed_version.state and "b" not in states.sensor.ha_latest_version.state -%}
            Yes
          {%- else -%}
            No
          {%- endif -%}
        {%- endif -%}

I won’t know for sure that the sensor and resulting alerts are working until the next update becomes available. Should work though.

Thanks for the idea to test for the “b” in the latest version … much appreciated.

1 Like

@aheath, @DavidFW1960
Hey guys,
Great ideas, but not what this original thread was about. You may want to start a new thread.

This is a nice enhancement, Thanks! The only thing I am trying to play with is the ability to get a repeating notification if I restart HA. For example, I see there is currently an update available for me but it will not trigger the notification because it’s not changing the state from No to Yes when I restarted HA because it is already Yes. So is there a way to maybe change the default state to “No” when HA restarts to have it change to “Yes” and then trigger the automation?

This was great while it lasted but “https://raw.githubusercontent.com/home-assistant/hassio/dev/version.json” no longer gives current version of hassio.

This is how the current json files provides ‘{“hassio”: “105”, “homeassistant”: “0.70.0”}’, but the current version is actually 0.71.0.

Nm, I found your new topic Wrong Version Showing? with updated link: https://s3.amazonaws.com/hassio-version/stable.json

You can download and try the package linked here as well if you would like…

Is this advanced feature still available? I don’t see it on my hassio

It’s on the system tab now.

On mine it just showed up again and it’s on the hassio dashboard.

Yes in the system tab

It has changed some, the update shows up under the dashboard as you discovered. It will show the new version and the current version. Remember that the new version for Hassio shows up a day or two after the release.

To find out the current version that you are running (when an update is not pending) go to the developer tools on the bottom of the left column and click on the information (about) button on the right. It will show the current software version.

Is it still possible to get a notification when a new Hass.io version is released?

One of the former posts mentioned that this isn‘t possible any more.
Is there a „new“ way to do this?

I’m eager to know this as well. I’m then trying to update HASS via a command: How to update HASSIO via command or script

I’m guessing you want to automate updates?

When I was running HassOS I’d like to do a snapshot backup before running an upgrade, just incase the update breaks something

No, I don’t want automated updates as I want the opportunity to read the release notes to check for breaking change it before performing the update. However, it is a sort of semi-automated update without having to visit the web interface.

Interestingly, talking about snapshots, it is possible to call the snapshot making process from services, so it will be possible to automate the whole process.