Update to latest release from last month?

I’m assuming that the most stable version at any one time will be the latest release of the previous month.

Is there a built in way to find that release so I can update to it from a button please?

Maybe you could do a scrape of the home assistant release page for that month or the forum section.
There no sensor available for it, I think, and the number of minor releases are not fixed either.

The version integration will give you sensors for the latest stable, beta and installed versions.

The update cycle usually* stops releasing stable minor versions when the first beta version is released on the last Wednesday of the month.

Create a triggered template sensor that triggers on the last Wednesday of the month (this would be a template trigger, see here for ideas: How to show date of last Wednesday of the month? - #51 by Troon ).

This would then copy the latest stable version sensor state as the template sensor state.

Your button would call a script that does this:

First a template condition: Is the installed version less than the template sensor version?
If not do nothing.
If so, update to the latest stable version.

* Vital security releases may occasionally be released during the beta week.

Thank you.

I don’t want to auto update. For example today is 17-July. I’d like to manually update today, but the only option from the gui is 2023.7.2.

image

I’d prefer to update to 2023.6.3 instead which I think is the last release from June. Just in case there are undiscovered bugs in 2023.7.2.

If nothing built in, then maybe I’m best just using the command line and specifying the version?

The only built in method to update is for the latest version. There are ssh commands that can update your system (hassos/supervised) by version.

I know. That is why I said:

And the template sensor would have the last minor version from last month as it only updates on the last Wednesday of the month.

Ah, well that’s spanners to my plan unless they push the update button during the beta week.

Well, you can do a specific version from the entity itself via the service call

Thank you for the help, I think I’ll just update to a specific version from the command line.

Is it worth raising as a feature request to be able update to a specific version via the GUI? Eg list the last 10 releases?

People have raised the FR in the past, I’m sure the team wouldn’t turn the work down. But I don’t think they will implement it, a volunteer will most likely need to do it.

I was looking to do the exact same thing and found this thread. I didn’t want to spend a ton of time automating this end-to-end, so I just wrote a script I can run quickly on my machine to get the command to upgrade to the latest version of HA Core from the previous month and then I copy paste the output into HA Terminal.

Just created a reminder for myself to do this on the 15th of each month and that works well enough for me :slight_smile:

import requests
import re
from datetime import datetime, timedelta

def get_previous_month():
    today = datetime.today()
    first_day_of_current_month = today.replace(day=1)
    last_day_of_previous_month = first_day_of_current_month - timedelta(days=1)
    return last_day_of_previous_month.strftime("%Y") + '.' + str(int(last_day_of_previous_month.strftime("%m")))

def get_latest_release():
    base_url = "https://www.home-assistant.io/changelogs/core-"
    previous_month = get_previous_month()
    
    url = f"{base_url}{previous_month}"
    response = requests.get(url)
    if response.status_code == 200:
        releases = response.text
        release_marker = f"{previous_month}."
        release_pattern = re.compile(release_marker + r"(\d+)")
        matches = release_pattern.findall(releases)
        if matches:
            latest_release = max(matches, key=lambda release: int(release))
            return f"{previous_month}.{latest_release}"
    else:
        raise Exception("Error fetching release information.")


latest_release = f"ha core update --version {get_latest_release()} --backup"
print(latest_release)