Update notifications! Core, HACS, Supervisor and Addons (now a blueprint!)

Not currently. You can only make a blueprint of an automation and automations can’t run commands on the command line or make http requests directly, both of which are needed to check for updates. Most of this work is sensors which do just that and the only easy way to share a bunch of sensors is a package that you must manually include.

Hopefully someday blueprints can include other config besides automations they depend on. Or even better, make a blueprint of a package itself. Then could just prompt the user for the notifier they want to use and be all set.

1 Like

Just a basic question as I´m finally looking into https://www.home-assistant.io/integrations/alert/ : alerts can only be created from yaml and therefore HA always needs to be restarted to read new alerts or changes on existing ones, right?

That´s really painful once you´re getting used to the quick “change and test” mode when using automations for notifications. Is there any way to avoid needing to restart HA?

Yea I know, it’s quite a bummer alerts didn’t get made reloadable from the UI as part of WTH month like so many other things. I still really like that they build in nagging reminders and those survive restarts but now I have to weigh the need for that against easy changeability. One notification when the update is available is probably enough, nagging reminders periodically might not be worth the hassle.

Although actually even automations can approximate alerts pretty closely. This nagging reminder blueprint is basically an alert as an automation for all intents and purposes.

A few posts up Hananv shared a package that uses an automation instead of alerts. If you want to switch I’d recommend taking a look at it. Can either bring it in as a base or use at as an example and replace the alerts in mine with an automation like that. Or if you want the nagging reminders then just drop the alerts from the package entirely and make a bunch of copies of the blueprint I linked instead, one per update sensor you want to get notified about.

Hey Folks :slight_smile:

I am also looking for a update status / notfier for my Home Assistant OS - but I read this topic till page 15 and I gave it really up!

I found node-red examples…
The URL “http://supervisor/supervisor/info” dont exist on my network - so the first post cant work for me…

In my opinion: this thread is confusing :frowning:
Is there an easy way to implement ?

If by this you mean you are trying to hit it via curl or something from your laptop then yes that won’t work. That URL only exists within the docker network when you are running supervisor. So HA can hit it since its running from within that docker network but you can’t hit it from your laptop.

Yes. The first post has two packages. The first notifies you of updates to Core, Addons and HACS packages. The second does all that and also adds update notifications for all the other supervisor components (audio, dns, cli, etc.) Pick one and drop it into your config as a package. If you need help understanding how to do that, take a look at the packages doc.

Lol ? I am working with docker since years and never saw an internal communication using http proto :o

Oops didnt recognized the drop down menus in your first post :smiley:
And thank you for your help - But I will test in tommorow… to much headdache lol

If I have questions I will write to you :slight_smile:

Well I can’t say I’m an expert on it but I’m pretty sure that’s all part of what supervisor does. The dev team always says supervisor is more then just a basic docker network. One of the things it does I believe is facilitate intercontainer communication. You can refer to the supervisor container from within the network at http://supervisor, the home assistant container at http://homeassistant, and other addons at http://<addon slug>. Or https for things running that way.

There’s probably lots of other tricks too, I feel like I discover new ones all the time lol.

True I can feel you - welcome in the docker world. Thats a normal feeling as I can say :smiley:

I didnt checked the structure of the core container from home assistant - limited time you know ? :smiley:

EDIT: I Imported your package file -> works great, but unfortunately without HassOS Update notification…
But I found a way to implement it by myself :slight_smile:

cant find the correct thread for my Stats question, so please allow me here, and point me to it if needed…

we have several Stats sensors for all add-ons, and Supervisor and Core, but I can make a Host sensor, like

  - platform: command_line
    name: Stats Host CPU
    command: >
      curl -sSL -H "Authorization: Bearer $SUPERVISOR_TOKEN" http://supervisor/host/stats
    unit_of_measurement: '%'
    value_template: >
      {{value_json.data.cpu_percent|round(2)}}
    scan_interval: 60
    json_attributes:
      - data

isn’t this possible, or am I simply using the incorrect path.
thanks for having a look

The available paths for Host in the Supervisor REST API can be found here. I don’t see a /stats (and get a 404 when I try). I think you’re looking for /info as that gives me a response like this:

{
    "result": "ok",
    "data": {
        "chassis": "embedded",
        "cpe": "cpe:2.3:o:home_assistant:hassos:5.12:*:production:*:*:*:odroid-n2:*",
        "deployment": "production",
        "disk_free": 77.1,
        "disk_total": 113.9,
        "disk_used": 31.1,
        "disk_life_time": 10.0,
        "features": [
            "reboot",
            "shutdown",
            "services",
            "network",
            "hostname",
            "hassos"
        ],
        "hostname": "homeassistant",
        "kernel": "5.9.16",
        "operating_system": "Home Assistant OS 5.12"
    }
}

Although unfortunately I don’t see anything about cpu utilization in there so I’m not sure if there’s a way to get to that. There’s a lot of APIs though, others on host as well as some on hardware. Perhaps that info is somewhere in there?

Alternatively, you saw the system monitor integration right? I use that to get this info on my host currently. If you just want to get at the number that might be easier? Although not sure what other metrics you were hoping for in data, it has a limited set of metrics it exposes.

thanks! I hadn’t seen tat page, and what a nice page it is, with the fold out response values. cool.

yes, I was looking for the memory usage, to have the 3 of them, Host, Core and Supervisor be displayed in a nice graph somehow, probably test it with the new circular apex charts-card …

yes, I do have the system monitor, but am not sure which usage that shows. Is it the total for all 3?

given the fact we doing have anything but used space in the supervisor window:

I am still trying to figure out what’s what… because I also see:

which seem to have no obvious connection with the supervisor panels

Oh ok. So I think system monitor gives you everything from the host itself except CPU temperature. I get that with this sensor, dunno if there’s a better way:

# CPU temperature
- platform: command_line
  name: CPU Temperature
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  unit_of_measurement: "°C"
  value_template: '{{ value | multiply(0.001) | round(1) }}'

For the three boxes up in the supervisor -> system panel, you can get all that data from these 3 endpoints:

http://supervisor/host/info			# Info on disk space
http://supervisor/supervisor/stats	# Info on supervisor CPU/RAM usage
http//supervisor/core/stats			# Info on core CPU/RAM usage

Idk why the first one is /info and the others are /stats but if I throw each of those in curl I see all the info and more being presented in those 5 bar graphs.

Where you got that last card image from (blue one)? Looking great!

thanks, and yes, using the temp sensor too here.
would wish the /hardware/info would do as it advertises… in my instance it outputs a huuuuge page of all possible data, and the displayed output in the docs is from some time ago, pure and simple. If I need to find the USB port for the zwave stick I have to scroll a ridiculous amount of lines…

/misc/info isn’t allowed?

1 Like

this is it:

type: picture-elements
image: /local/homeassistant/homeassistant.png
style:
  '#root>bar-card':
    $: |
      ha-card {
        background: none;
        box-shadow: none;
      }
      bar-card-name {
        color: white;
        font-size: 100%;
        font-weight: normal;
        margin: 4px;
      }
      bar-card-currentbar {
        border-radius: 7pt;
      }
      bar-card-backgroundbar {
        border-shadow: 2pt;
        margin-top: -2pt;
        margin-left: -2pt;
        border-radius: 7pt;
        border-style: solid;
        background: rgba(255, 0, 0, 0.8);
      }
      bar-card-value {
        font-size: 125%;
        color: white;
        font-weight: bold;
        margin: 4px;
      }

elements:
  - type: state-label
    entity: sensor.last_boot_phrase
    prefix: 'Last boot: '
#    title: text
    style:
      color: white
      font-size: 90%
      left: 65%
      top: 25%

  - type: custom:bar-card
#    animation:
#      state: 'on'
    columns: 5
    direction: up
    width: 10px
    height: 90px
    positions:
      icon: off
      indicator: off
      minmax: off
      title: outside
      value: outside
      name: outside
    style:
      left: 50%
      top: 68%
      width: 100%
      scale: 100%
    entities:
      - entity: sensor.processor_use
        max: 100
        min: 0
        name: Cpu
        severity:
          - color: '#40bf40'
            from: 0
            to: 40
          - color: '#ffde00'
            from: 41
            to: 80
          - color: '#fd0000'
            from: 81
            to: 100
      - entity: sensor.cpu_temperature
        max: 100
        min: 0
        name: Temperature
        decimal: 0
        severity:
          - color: '#40bf40'
            from: 0
            to: 40
          - color: '#ffde00'
            from: 41
            to: 75
          - color: '#fd0000'
            from: 75
            to: 100
      - entity: sensor.memory_use
        max: 4096
        min: 0
        name: Memory
        decimal: 0
        severity:
          - color: '#40bf40'
            from: 0
            to: 1280
          - color: '#ffde00'
            from: 1280
            to: 2500
          - color: '#fd0000'
            from: 2500
            to: 4096
      - entity: sensor.disk_use_home
        max: 64
        min: 0
        name: Disk
        decimal: 0
        severity:
          - color: '#40bf40'
            from: 0
            to: 25
          - color: '#ffde00'
            from: 25
            to: 50
          - color: '#fd0000'
            from: 50
      - entity: sensor.swap_use
        max: 1024
        min: 0
        name: Swap
        decimal: 0
        severity:
          - color: '#40bf40'
            from: 0
            to: 640
          - color: '#ffde00'
            from: 640
            to: 768
          - color: '#fd0000'
            from: 768

haven’t checked it for a while, so maybe settings in the card-mode or bar card have changed meanwhile. This is still working as it should though :wink:

2 Likes

Was sensor.hacs_updates supposed to be sensor.hacs? Looks like in the HACs documentation that’s the sensor name for updates.

Ah yea, I need to update that. It used to be sensor.hacs_updates but this was originally made a while ago. I believe it changed to sensor.hacs when v1.0 came out since a lot changed at that point.

I still have it as sensor.hacs_updates in my system since I just clicked and changed the entity ID. But I should update it to use the default name as most people will have that.

1 Like

Just to note: HA Core v2021.4 brings some enhancements for Supervisor:

The Supervisor is now also in the integrations dashboard, and provides entities for all kinds of things! These entities are disabled by default, so head over to the integration and see if there anything in there you could use. Thanks @raman325!

grafik

So this way you can now - out of the box - use entities for current version and available updates for addons including for Home Assistant OS.


grafik
grafik

sensor.home_assistant_operating_system_version
sensor.home_assistant_operating_system_newest_version
binary_sensor.home_assistant_operating_system_update_available

grafik

Downside: 3 single entities where @CentralCommand’s command line sensor definition only needs one entity with three attributes. For this reason I´ll not switch to the Supervisor integration provided version and update information. Never change a running system :slight_smile: , might be of interest for people starting from scratch with update notifications though.

It is fantastic! :tada:
However, in this way there are many more entities, while with a single sensor you have news on more addons for example (update available, current version, new version)
uhmmm, and you don’t know if an addon is working or not. :frowning_face:

Yea I’ve been looking into this. I had a long chat about this in #beta in discord during the beta to see if I could convert over to using those sensors for info on whether the update is available instead of hitting the supervisor API with curl.

Unfortunately its pretty tricky to just update the package to those because there’s really no easy way to find them. The sensors created by the integration don’t have a common pattern in their entity ID that would make them easily findable by for loop to quickly see if any addons have updates. It also doesn’t look like they have an attribute or anything that makes them easily identifiable. They do all come from the same integration but that info can’t be leveraged in a template currently.

However blueprints do have selectors around integrations so I’m revisiting that in light of this. But I really don’t want to make a blueprint that requires people make one per addon as that just seems like a lot of grunt work and then a lot of automations clogging their list. One in total would be ideal, trying to see if that’s possible.

Anyway I’m still looking into it (and if anyone has any good ideas please share!). For now though I’m going to leave the package as is.

3 Likes