We’re only half way though the month and there have already been FIVE updates to Home Assistant! This is awesome, but its an annoyance to constantly see a pending notification about updates being available and then manually having to kick them off.
Please add a feature to automatically apply these updates, similar to how we can already automatically update our add-ons. It would be best if we could also schedule a maintenance window so that only once per day/week/month between user definable hours that updates are checked and if any are found, they automatically download, perform a full backup, and then install during the maintenance window. There could even be an option for installing the current version vs, n-1, n-2, etc. or maybe even the Microsoft way: Fast ring vs slow ring for people who want to be on the latest and greatest with more updates, or people who rather apply less updates but know they have been used longer and therefor more stable.
Manually installing updates at this high of a rate is just not feasible anymore and it would be great if we could automate this.
I understand your thinking and the goal.
But I will not be happy with this. If, then make it user selectable.
After some years with HA, knowing, how it works, I won’t allow the system to update automatically without me reading the changelog first.
Waking up in a broken house because of an update is not, what I want. That’s, why I only update, when I know, I have some hours of time in front of me to be able to act. Read the breaking changes, try the update and maybe even rollback, if it goes wrong…
With the introduction of the update entities in Home Assistant 2022.4, you can do that already. You can create an automation that runs the update.install service targeting the thing you’d like to update.
But handle with care, auto-update also means: auto breaking.
You really want to read the breaking changes before upgrading major versions.
I totally understand your point, but with the ease of “rebuilding” HA from a backup, it’s pretty painless these days should something break. I accept that risk and that’s why I’m looking to automate this. I certainly wouldn’t want this to be a forced feature but rather an opt-in that users could enable if they choose.
This sounds like a great step in the right direction. For the benefit of everyone looking to do this, could you provide some more details on how one would set this up? How do I define when this would happen? I only see “time” as a trigger in automations and I wouldn’t want it to run every day. (maybe once a week at certain time would be fine) and if I get that to work, would calling that service automatically kick off a backup prior to the update, or do I need to call another service first to do that?
I was able to get this working for minor updates but not for the Home Assistant Operating System. (at least versions 8.0 and 8.1 have shown pending and have not been automatically applied.)
My reply was only to explain how to do this. Which you didn’t do.
(maybe once a week at certain time would be fine)
Personally, I don’t think automatic updates for HA at the moment is really are good idea.
However, I can see a few things here.
The supervisor updates itself automatically. There is no need to automate it.
Most addons can update themselves automatically. No need to automate. Check the addon configurations.
You seem to be using a mix of device id’s and entity id’s. Perhaps this is a product of using the UI for your automations but it doesn’t make sense to me.
OS and Core updates are going to trigger a restart which means any other pending update won’t install until the next trigger time.
update.home_assistant_operating_system_update is listed twice (actually 3 times it looks like one of those device id’s corresponds to the same entity.
@jazzyisj I initially had a condition so it would only run once a week but still got sick of the pending updates that would take days to clear. I now have it run every morning at 4 AM and a backup is taken at 3 AM via the Google Drive Backup add-on, plus the backup is taken by HA before doing the upgrades anyways.
I took a look through the thread you linked to and pretty much all the responses are saying “don’t this…breaking changes…” I don’t care! I have daily backups and if an auto update breaks my setup I can restore my backup within minutes. Even a full nuke and pave can be done in 10-15 mins these days. I don’t care about the risk, I just want the thing automatically updated while I’m sleeping so I don’t have to see all the pending updates.
You made a good point about the addon’s being duplicated (I have them added into this automation in addition to the “auto update” toggle on the addon itself.) I will remove them from my automation and let the toggle do it’s magic. Also good to know that the supervisor will keep itself updated as well.
Entity ID and Device ID are either or. You don’t need them both.
Anyway, we’re kinda getting away from a Feature Request here. I’d keep tabs on that other thread to see if they come up with any epiphanies over there and if you need any more assistance I’d post your question over there. There seems to be few people active in that thread.
Thats… actually not a bad idea. A minor/major release attribute would make that easy enough.
In the meantime, you could probably figure this out yourself on a per entity basis with a template. Since every component has it’s own versioning scheme you’d have to figure out the template for each update individually.
{{ states('update.home_assistant_core_update','on')
and state_attr('update.home_assistant_core_update','installed_version')[:6]
== state_attr('update.home_assistant_core_update','latest_version')[:6] }}
{{ states('update.home_assistant_operating_system_update','on')
and state_attr('update.home_assistant_operating_system_update','installed_version').split('.')[0]
== state_attr('update.home_assistant_operating_system_update','latest_version').split('.')[0] }}
Both of these should evaluate to true if there is a minor update version available.
The update.install service is still not working for the Home Assistant Operating system. This is how I have it configured. Is there something I’m missing, or have I ran into a bug?
I ended up figuring this out. Having the “Backup” option enabled causes it to fail. After disabling the option to take a backup before the update fixed the issue and caused it to run. This obviously isn’t a good idea so a work around is to use the Google Drive addon and use that to schedule a backup before the update service is called. In my case I have a backup set to run every morning at 3 AM and then an automation to run the update service every day at 4 AM. If I wake up and find my system hosed, I can download the backup from Google Drive, format my Pi, and restore from the backup taken right before the upgrade. It would be nice if the built in backup option was supported but at least for now I found a workaround.
Would it be possible to match this with the breaking changes list, to validate the breaking change and if what we use is in the breaking change then don’t update and send a notification or a mail