Get notified of Available Hassio Addon Updates

Thanks for the quick response.
If you don’t mind a few more questions
In the sensor you have the following…

 - platform: rest
    resource: http://192.168.1.2:8123/api/hassio/addons/a0d7b954_adguard/info
    name: adguard

In the text you say

For example this adguard add-on URL ends in /hassio/addon/a0d7b954_adguard

Notice the url… /hassio/addons/ versus /hassio/addon/

My url for adguard is /hassio/addon/
Which do I use for the sensor url?

Also mine does not have the /api/ (but I left it in the url)

carltonb

Interesting.

The URL when i go to an add-on says addon while my sensor says addons
I wonder if there was a change at some point but they both still work. Not sure on this one. I would go addons as I know that currently works for the rest api. The only thing you need to pull from the URL on the supervisor page is the add-on name (ie. a0d7b954_adguard)

the /api/ comes from the developer docs.

What typo was that? I have the exact same problem

EDIT: Found it myself. It’s /api/hassio/addons not /api/hassio/addon. The later did not work for me.

since today; this sensor is broken? Prevviously it compared the installed adoon vs addon available, and it gave an integer back when a new version was available
not it prompts that all my addons are outdated? :slight_smile:

  - platform: command_line
    name: Supervisor Addon updates
    command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"addons":[.data.addons[] | select(.version != .installed)]}'''
    value_template: "{{ value_json.addons | length }}"
    scan_interval: 1440
    json_attributes:
    - newest_version
    - current_version
    - addons

output it gives : 5

newest_version: 2020.10.0
current_version: 2020.10.0
addons: 
- name: Samba share
  slug: core_samba
  description: Expose Home Assistant folders with SMB/CIFS
  state: started
  version: 9.3.0
  version_latest: 9.3.0
  update_available: false
  repository: core
  icon: true
  logo: true
- name: SSH & Web Terminal
  slug: a0d7b954_ssh
  description: SSH & Web Terminal access to your Home Assistant instance
  state: started
  version: 7.6.0
  version_latest: 7.6.0
  update_available: false
  repository: a0d7b954
  icon: true
  logo: true
- name: deCONZ
  slug: core_deconz
  description: Control a Zigbee network with ConBee or RaspBee by Dresden Elektronik
  state: started
  version: 6.4.1
  version_latest: 6.4.1
  update_available: false
  repository: core
  icon: true
  logo: true
- name: Check Home Assistant configuration
  slug: core_check_config
  description: Check current Home Assistant configuration against a new version
  state: stopped
  version: 3.6.0
  version_latest: 3.6.0
  update_available: false
  repository: core
  icon: true
  logo: true
- name: motionEye
  slug: a0d7b954_motioneye
  description: 'Simple, elegant and feature-rich CCTV/NVR for your cameras'
  state: started
  version: 0.10.2
  version_latest: 0.10.2
  update_available: false
  repository: a0d7b954
  icon: true
  logo: true

friendly_name: Supervisor Addon updates

any idea what i need to change?

@pergola.fabio you likely want to ask your question in the thread linked below. This thread doesn’t utilize the method you posted.

will do , but no idea anyway? :slight_smile:

Looks like they changed the data model of the API response and it broke. I figured it out, will update on the thread.

Perfect, thnx

Sometimes is better to read the change log. Without reading it you don’t know whats new, or whats changed. It would be nice to have in every AddOn automatically a sensor created that shows a “Update available”

Hi All,

Will it be possible to change the value_template to something like this:

{% if is_state(version < version_latest) %} on
{% else %} off
{% endif %}

When the current version is lower then the latest one, the sensor will be ON
With this state you can create other automations around it.

- platform: rest
  resource: !secret supervisor_addon_1
  name: "Adguard Version Update"
  value_template: "{{ value_json.data.state }}"
  scan_interval: 14400
  headers:
    Authorization: !secret longlifetoken
    Content-Type: application/json
  json_attributes_path: "$.data"
  json_attributes:
    - version
    - version_latest

sure, but since it is always dangerous comparing strings like that, why not simply use

{{ version != version_latest }}

of course you’d need to use a {% set version = xxx %} and same for version_latest

o heck, wait, I now realize you meant this to be in the rest sensor. I wrote my answer to be a separate binary_sensor.
my pardon

that would be my preferred way though, keeping the main sensor as is, and create some (binary) template sensors off off that.

like this for the supervisor updates:

    addon_updates_available:
      friendly_name: Addon update available
      value_template: >
        {{states('sensor.supervisor_updates')|int != 0}}
      attribute_templates:
        Updates: >
          {{states('sensor.supervisor_updates') if
            states('sensor.supervisor_updates')|int != 0  else 'No'}} update{{'s' if
            states('sensor.supervisor_updates')|int != 1 else ''}} available

This blueprint might help: