If you select one of these options, it will be stored in your web browser and automatically applied to other pages on this website.

Automatic patch version updates in Home Assistant

Getting the latest bugfixes into Home Assistant without manual work

I've been using Home Assistant for about 5 years. In that time, there's been a steady stream of software updates which need installing. There are sometimes three or four in a month.

Usually, these take a few minutes and are uneventful. Can this bit of manual work be automated away? I started investigating automatic updates in Home Assistant OS.

Should you do this?

If you start reading around the idea of automatic updates, you'll find a lot of good advice. One of the most common pieces of advice is "don't do it". The usual reason is that there are often breaking changes, so you should read the release notes first.

This is an important point. I use Home Assistant for few important tasks, like as an alarm clock and a way of accessing cameras. I do have appropriate backup systems (like an alarm clock on my watch), but I don't want to break Home Assistant avoidably. I've had enough small things break after updates to know that I don't want a big update without reading the notes.

Usually, though, patch releases only include tiny bug fixes. It would be good to get these without the manual work. That way, I could apply one feature update a month myself and everything else could take care of itself.

I thought about how I'd like automatic updates to work, and came up with the following:

  • Patch (bug fix) releases are OK to install without reading the release notes
  • I have a good, 3-2-1 backup strategy working, with backups on the Home Assistant SSD, the local NAS and a cloud copy
  • I want to be in the loop, so updates should only happen when I'm home and awake. A notification is enough to let me know it's about to happen.

This isn't a one-size-fits-all approach. This is what works for my situation. You might rely more on Home Assistant and not be comfortable with this. Or you could take it even less seriously than I do and think this list is overkill.

How I do it

Recent updates to Home Assistant make keeping routine backups and offsite backups easy. All the other conditions, listed above, are verified by automation.

I have an automation, set to run every four hours. Four hours is an arbitrary choice. Most of the logic is in the conditions.

First, it checks if there is an update available. The state of the "Home Assistant Core Update" entity will be "on" ("Update available") if there is.

conditions:
  - condition: state
    entity_id: update.home_assistant_core_update
    state: "on"

Next, it checks if this update is a patch release. This is a template evaluation - it compares for first seven characters of the version string. Home Assistant's "year-month" version numbering scheme means the first seven characters are either:

  • Year, month in months with two digits, for example 2024.12
  • Year, month and a trailing dot in months with one digit, for example 2025.3.

If the currently installed version and the latest version have the same first seven characters, this is a patch update.

- condition: template
  value_template: >-
    {{ state_attr("update.home_assistant_core_update",
    "installed_version")[0:7] ==
    state_attr("update.home_assistant_core_update", "latest_version")[0:7] }}

Next, a zone condition checks if I'm actually at home.

- condition: zone
  entity_id: person.[ME]
  zone: zone.home

And a state check confirms whether sleep mode is off (meaning I'm not asleep). To be extra-safe, I make sure it's been off for 15 minutes, to avoid a possible race condition, where the update interrupts the alarm clock automations.

- condition: state
  entity_id: input_boolean.[SLEEP_MODE]
  state: "off"
  for:
    hours: 0
    minutes: 15
    seconds: 0

If all conditions are true, it's time to install the update.

First, send me a mobile app notification.

- action: notify.[HOME ASSISTANT APP]
  data:
    message: Starting an automatic update

Then, install the update by calling the action.

- action: update.install
  target:
    entity_id: update.home_assistant_core_update

Putting it all together

If you want to try this, you can get started with this YAML version of the automation. Remember to swap the things in brackets.

alias: "HA Core: Auto-update patch versions"
description: ""
triggers:
  - trigger: time_pattern
    hours: /4
conditions:
  - condition: state
    entity_id: update.home_assistant_core_update
    state: "on"
  - condition: template
    value_template: >-
      {{ state_attr("update.home_assistant_core_update",
      "installed_version")[0:7] ==
      state_attr("update.home_assistant_core_update", "latest_version")[0:7] }}
  - condition: zone
    entity_id: person.[ME]
    zone: zone.home
  - condition: state
    entity_id: input_boolean.[SLEEP_MODE]
    state: "off"
    for:
      hours: 0
      minutes: 15
      seconds: 0
actions:
  - action: notify.[HOME ASSISTANT APP]
    metadata: {}
    data:
      message: Starting an automatic update
  - action: update.install
    target:
      entity_id: update.home_assistant_core_update
    data: {}
mode: single