You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue with the Auto-Update blueprint where, when an update fails (in my case an addon update via HACS), the script does not skip to the next item. Instead, it waits 1 hour and then attempts the same update again, repeating this process each hour.
My situation:
I have two Shellies Discovery addons that won’t update due to my current HA Core version. So it's necessary to update the core first.
As I understand it, the Auto update script will try to update addons first, then core items, then OS, and so on.
What I expect is that my case the sequence would go like this:
Attempt to update "Shellies Discovery Gen2" addon (fails due to core version)
Attempt to update "Shellies Discovery" addon (will also fail)
Update HA Core
(And if all goes well the remaining updates would be applied on the next day/update schedule)
But whats happening looking at the logbook and traces is this:
Attempt to update "Shellies Discovery Gen2" addon (fails due to core version)
Then proceeds to restart HA
Likely because of the pending restart from the HACS update from the day before, but it shows that the script wasn't crashing and restarting in between update attempts.
I'm not sure why it stopped after the third time, but I believe it was because the update schedule window which I set for testing happened to be 2 hours long.
Investigation:
I examined the script and found a potential cause.
In this line, the script selects the top entry from the pending_update_list as entity_id for the update.install action, but if the update fails, this entry will still be in the list in the next iteration, because the update state for that entity also doesn't change.
As a result, if an update fails (as in my case, due to version restrictions), the script keeps looping over the same update indefinitely, or until the scheduled update window ends.
Unfortunately, my HA scripting skills are not up there yet, so I'm not sure how to fix this.
However, one potential solution could involve creating a local list variable (outside the loop) to track updates that have already been attempted. This list could be used as an additional filter in subsequent iterations, ensuring that each update is only tried once during a single script execution.
Btw, I understand I could resolve this manually by updating the core, but I wanted to report what I believe is a bug so that we can continue to improve this very useful script 😊
The text was updated successfully, but these errors were encountered:
This is challenging to duplicate...
Do you still have any case of those failing updates? If so, could you please share it's state and attributes?
I wanna see how the info about the failure is stored.
Please make sure you have removed any sensitive info before sharing. 😉
No, I ended up updating the core module manually, and as expected, everything is working normally now.
I did save a trace of the automation as a JSON file, but it’s almost 3,000 lines long, and I was hoping to avoid having to clean it up for posting 😅. It’s probably easier to reproduce the issue than to go through the trace anyway.
To reproduce, try installing Shellies Discovery Gen2 and Shellies Discovery via HACS, and make sure to install (or downgrade to) the versions of HA Core and the addons that I mentioned above next to the red arrows.
I encountered an issue with the Auto-Update blueprint where, when an update fails (in my case an addon update via HACS), the script does not skip to the next item. Instead, it waits 1 hour and then attempts the same update again, repeating this process each hour.
My situation:
I have two Shellies Discovery addons that won’t update due to my current HA Core version. So it's necessary to update the core first.
As I understand it, the Auto update script will try to update addons first, then core items, then OS, and so on.
What I expect is that my case the sequence would go like this:
(And if all goes well the remaining updates would be applied on the next day/update schedule)
But whats happening looking at the logbook and traces is this:
Likely because of the pending restart from the HACS update from the day before, but it shows that the script wasn't crashing and restarting in between update attempts.
I'm not sure why it stopped after the third time, but I believe it was because the update schedule window which I set for testing happened to be 2 hours long.
Investigation:
I examined the script and found a potential cause.
HomeAssistant-Config/blueprints/automation/EdwardTFN/auto_update_scheduled.yaml
Line 723 in 833d07c
In this line, the script selects the top entry from the
pending_update_list
asentity_id
for the update.install action, but if the update fails, this entry will still be in the list in the next iteration, because the update state for that entity also doesn't change.As a result, if an update fails (as in my case, due to version restrictions), the script keeps looping over the same update indefinitely, or until the scheduled update window ends.
Unfortunately, my HA scripting skills are not up there yet, so I'm not sure how to fix this.
However, one potential solution could involve creating a local list variable (outside the loop) to track updates that have already been attempted. This list could be used as an additional filter in subsequent iterations, ensuring that each update is only tried once during a single script execution.
Btw, I understand I could resolve this manually by updating the core, but I wanted to report what I believe is a bug so that we can continue to improve this very useful script 😊
The text was updated successfully, but these errors were encountered: