Check for osagent and supervised Update

Is there an automation or something else to get notified if there is an os-agent or supervised update avaiable? Currenty i have to check manuallly the repo release page :frowning:
Iam using debian11

1 Like

Hi, thanks for the starting point, but apart from the github integration, iam missing the sensors for the current supervised/os-agent version (package)

Post two in that link has the rest sensors you want.

You need to make them.

1 Like

Another thanks, seems to be iam blind… :smiley:

So for OS_agent iam fine, the problem i have right now is, that i cant get the installed homeassistant-supervised version. (github is showing me the release tag instead of the version number). I guess this is not that cirtical, becasue homeassistant-supervised is checking itself for an update… but it never worked :frowning:

Not sure why you need the supervisor installed version…

But it is the same as the installed version of os-agent. You need to make another rest sensor. You can reuse the long life token. The endpoints are in the link at the bottom of post two.

supervisor/info

or actually

you should be able to use

update.home_assistant_supervisor_update and it’s attribute

{{ state_attr("update.home_assistant_supervisor_update", 'installed_version') }}

1 Like

The problem, it doesnt match the github version/tag.

See:

ii homeassistant-supervised 1.3.1 all Home Assistant Supervised
ii os-agent 1.4.1 amd64 Home Assistant OS Agent

where the version == tag. I cant get the actual version from the CLI, because i cant fnd it in the API. The only string i can get is: “2022.10.0” which on the other hand is not listed in guthub

post your sensors.

Supervisor and os-agent are unrelated in terms of versions for os-agent.

If you have the github integration installed. You need to :star: home-assistant/os-agent repo and add it to the github integration.

That should make

sensor.home_assistant_os_agent_latest_tag

or

sensor.home_assistant_os_agent_latest_release

The rest sensor will make

sensor.os_agent_version

Then you make a template sensor

template:                  ##  <<< template Only needed for top template entry
 - sensor:
        - name: OS_agent Updater
          unique_id: os_agent_updater_version8123
          icon: mdi:memory
          state: >
             "{{ states('sensor.home_assistant_os_agent_latest_tag' ) > states('sensor.os_agent_version' ) }}"
1 Like

I guess you get me wrong.

Its working for the OS-Agent package without any issue.

My problem is the homeassistant-supervised package, see GitHub - home-assistant/supervised-installer: Installer for a generic Linux system … this needs to be updated regulary as well.

the ultra ugly way would be, to create a cronjob inside my hostsystem which sends the actual version to my influxdb which could be read by home assistant but… uuuaaaah please no :smiley:

Ahh right, I did think you were still talking os-agent.

Thank link is to the installer script. not supervisor.
You want as a template sensor

{{ state_attr("update.home_assistant_supervisor_update", 'latest_version') > state_attr("update.home_assistant_supervisor_update", 'installed_version') }}

You don’t need a rest sensor for that. Although supervisor will already send you a notification if it needs updating(assuming you aren’t disabling that).

You don’t need to reinstall with the installer script except for a fresh install.

1 Like

Yeah, the installer script, as far as i can see, you can get in trouble if the installer script is outdated, even if its a running instance, because they will add dependencies to the os from time2time (and if you just install it, it will auto solve the dependencies without any user action required, like hass OS). Supervisor itself is easy going, i dont take care here because it has build in notifications as you already pointed out.

Well you don’t need to use the installer script…

You can just add whatever dependency was added to the script.

If you want a notification of when it changes. Do it the same as the early automation in the earlier link.

just swap the sensors to

sensor.home_assistant_supervised_installer_latest_release

in this automation


alias: Os-Agent Update
description: OS Agent upgrade available
trigger:
  - platform: state
    entity_id:
      - sensor.home_assistant_os_agent_latest_release
    attribute: tag                    ## <<<<<<<<< the attribute 
condition:
  - condition: template
    value_template: >-
      {{ trigger.from_state.attributes.tag != "unavailable" and
      trigger.from_state.attributes.tag != "unknown"  }}
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.home_assistant_os_agent_latest_release
        attribute: tag           ## <<<<<<<<< the attribute
        state: unavailable
      - condition: state
        entity_id: sensor.home_assistant_os_agent_latest_release
        attribute: tag          ## <<<<<<<<< the attribute
        state: unknown
 
action:
  - service: persistent_notification.create
    data:
      notification_id: os-agent
      title: "There is an update in Os-Agent! "
      message: >-
        OS_Agent {{ states('sensor.home_assistant_os_agent_latest_tag') }} is
        available<br></br> [os-agent
        latest](https://github.com/home-assistant/os-agent) <br></br> wget
        https://github.com/home-assistant/os-agent/releases/download/{{
        states('sensor.home_assistant_os_agent_latest_tag')
        }}/os-agent_1.4.0_linux_x86_64.deb<br></br> sudo dpkg -i os-agent_{{
        states('sensor.home_assistant_os_agent_latest_tag')
        }}_linux_x86_64.deb<br></br>
mode: single

Just increase the tag number when you want to test the automation

Here I thought that one might be useful so I made it anyway.

alias: Sup Install script Update
description: Supervisor Installer script got an update
trigger:
  - platform: state
    entity_id:
      - sensor.home_assistant_supervised_installer_latest_release
    attribute: tag
condition:
  - condition: template
    value_template: >-
      {{ trigger.from_state.attributes.tag != "unavailable" and
      trigger.from_state.attributes.tag != "unknown"  }}
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.home_assistant_supervised_installer_latest_release
        attribute: tag
        state: unavailable
      - condition: state
        entity_id: sensor.home_assistant_supervised_installer_latest_release
        attribute: tag
        state: unknown
action:
  - service: persistent_notification.create
    data:
      notification_id: sup_install_script
      title: "There is an update for Supervisor Installer script! "
      message: >-
        Supervisor Installer Script {{
        state_attr('sensor.home_assistant_supervised_installer_latest_release',
        'tag') }} has been updated <br></br> [Supervisor Installer
        Script](https://github.com/home-assistant/supervised-installer) 
mode: single


Hey, thats also an veeery good idead, instead of compare, just check if it changed… :smiley:
Thanks men, this is gold for me!

It’s borrowed from there… So I won’t take credit for it.

It will only notify you once. So once it’s dismissed it won’t come back until the next new update