Get notified of Available Hassio Addon Updates

Can you share your config?

I looks like the sensor is making the call but its getting nothing in return.

Here it is… the !secret llt is the long result i got from creating a new LLT

Is this still working? I get “REST result could not be parsed as JSON” in logs.

Yes, post your config, maybe I can help troubleshoot.

Found my error, typo :crazy_face:

Did you solve this problem? I have it too with my config:

    resource: http://192.168.50.54:8123/api/hassio/addon/core_deconz/info
    name: deconz
    value_template: '{{ value_json.data.state }}'
    scan_interval: 60
    headers:
      Authorization: !secret llt
      Content-Type: application/json
    json_attributes_path: "$.data"
    json_attributes:
      - version
      - version_latest

Log Details (WARNING)

Logger: homeassistant.components.rest.sensor
Source: components/rest/sensor.py:249
Integration: rest (documentation, issues)
First occurred: 10:20:31 PM (6 occurrences)
Last logged: 10:25:39 PM

Empty reply found when expecting JSON data

Any ideas?

I am having problems with this…

secret llt is a long lived token. To obtain a long lived token, go to your users profile page and scroll all the way to the bottom. Create a token and copy it in to your config. Once you close the window with the LLT you cannot view the token again so be sure to record it. My secret is formatted as follows: llt: "Bearer adfasdfadsfadsfasdfasdfasdfNiJ9.eyJpc3adfasdfasdfTZlZWQ0Nzsuperlongstring of numberslettersetc" Be sure to add the Bearer before the token and place the entire thing in quotes.

When I go to the bottom of the page an click create token, it asks for a name I name it Bearer, then I click ok. It produces a llt. I copy this to my secrets file looking like this.
‘Bearerjbf;qkbgfbrgbgbrbgbgbgbbgbergbgbrbg’
Is this what I am supposed to do?

Also when creating the sensor the resource has an http address:8123, I am using Nabu Casa, what do I add.
Thanks for the help.

Add a space after bearer in the secret.

If you are are using nabu casa you should be able to use just the ip with http for this internal call. Just as shown in the example.

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: