HomeAssistant-Config icon indicating copy to clipboard operation
HomeAssistant-Config copied to clipboard

Update failed - Step "Wait for backup complete" failed - UndefinedError: 'pending_update_list' is undefined**

Open NordFreak opened this issue 1 year ago • 26 comments

Hello, unfortunately I have had the problem for months that this blueprint does not work for me.

I have reimported the BluePrint and also changed the settings (created a new automation), but unfortunately this has not changed anything.

With one step I always get:

Error: In 'template' condition: UndefinedError: 'pending_update_list' is undefined

From Systemlog:

``Logger: homeassistant.components.automation.xsystem_automatisches_update_system Quelle: components/automation/init.py:776 Integration: Automatisierung (Dokumentation, Probleme) Erstmals aufgetreten: 05:00:51 (1 Vorkommnisse) Zuletzt protokolliert: 05:00:51

Error while executing automation automation.xsystem_automatisches_update_system: In 'template' condition: UndefinedError: 'pending_update_list' is undefined`

`Logger: homeassistant.components.automation.xsystem_automatisches_update_system Quelle: helpers/script.py:2026 Integration: Automatisierung (Dokumentation, Probleme) Erstmals aufgetreten: 05:00:51 (4 Vorkommnisse) Zuletzt protokolliert: 05:00:51

xSYSTEM - Automatisches Update System: Backup: If at step 3: If at step 3: Error executing script. Error for wait_template at pos 1: In 'template' condition: UndefinedError: 'pending_update_list' is undefined xSYSTEM - Automatisches Update System: Backup: If at step 3: Error executing script. Error for if at pos 3: In 'template' condition: UndefinedError: 'pending_update_list' is undefined xSYSTEM - Automatisches Update System: Backup: Error executing script. Error for if at pos 3: In 'template' condition: UndefinedError: 'pending_update_list' is undefined xSYSTEM - Automatisches Update System: Error executing script. Error for if at pos 8: In 'template' condition: UndefinedError: 'pending_update_list' is undefined`

And the entire script aborts. I have deliberately not installed the latest HA version as I still need something to test. I usually keep my versions up to date manually, but this time I didn't do it because I want to tackle the problem with the AutoUpdate.

Here is my current starting situation. If any information is missing, please let me know.

grafik grafik

Here the code: alias: xSYSTEM - Automatisches Update System description: "" use_blueprint: path: edwardtfn/auto_update_scheduled.yaml input: schedule_entity: schedule.automatisches_update_zeitfenster actions_pre_restart: - metadata: {} data: title: HA Reboot message: Das System wird aufgrund von Updates {{ updates_list }} rebootet action: notify.mail_chris actions_pos_update: - metadata: {} data: title: HA Update complete message: >- Der automatische Updateprozess ist durchgelalufen. Bitte prüfen ob alles läuft. Geupdated wurde: {{ updates_list }} action: notify.mail_chris restart_type: core verbose_logging_bool: true

Pending Updates: grafik

I would be very happy if the problem can be solved. Since the error looks to me like it comes from the blueprint, I unfortunately need a little help here. Many thanks in advance!

NordFreak avatar Sep 28 '24 07:09 NordFreak

I believe that is fixed now. Could you please reload the blueprint and try again?

edwardtfn avatar Sep 30 '24 05:09 edwardtfn

I believe that is fixed now. Could you please reload the blueprint and try again?

Oh, that was fast. Sorry, I didn't expect you to fix the error so quickly. I did a re-import but currently have no more updates open as I installed them yesterday. But the next update should be released in the next few days. I'll test it then and get back to you, I promise.

NordFreak avatar Sep 30 '24 12:09 NordFreak

Good morning,

So there was one today, for the ESP. Unfortunately, it didn't go through, even though the email notification suggested otherwise.:

grafik

Unfortunately, an update is still available:

grafik

But I could no longer find an error message in the system log.

However, I must mention that this morning, when the process would have run automatically, the ESP update was also not yet available. I started the automation manually.

Here the trace:

grafik ..... grafik

What other data do you need from me? Or do you have all the information you need ?

NordFreak avatar Oct 01 '24 09:10 NordFreak

Good Morning,

So this morning two update processes started automatically in the scheduled time window:

The first one updated ESPHome and Zigbee. This also worked technically, but unfortunately update_list does not seem to be output. Here are two screens, one shows the output and the other the config in the BP.

grafik

grafik

Then the update process started again, this time the mail output was correct, but it was not updated:

grafik

What data / traces do you still need for further analysis?

But thank you very much for your work. If the notifications work properly now, I'll be happy. I already know that the ESP firmwares don't run through, or should that actually work too?

NordFreak avatar Oct 02 '24 05:10 NordFreak

I will take a look... I've never used the post-update myself, so I will try that. Probably the variable is being update during the update, so it is complete on pre-update (where I'm using) but not at the post-update.

edwardtfn avatar Oct 02 '24 06:10 edwardtfn

I believe that is fixed now and updates_list should be working fine at any point. I've also created a new var pending_updates_list which will contain at any point the items pending updates (due to a failure?).

edwardtfn avatar Oct 02 '24 06:10 edwardtfn

Thank you very much, I have done a re-import and am waiting for the next run. Currently only the ESP firmware is still open but I think there will be an HA update in the next few days. I'll get back to you and report back.

NordFreak avatar Oct 02 '24 07:10 NordFreak

HA v2024.10.0 will come later today. 😉

edwardtfn avatar Oct 02 '24 08:10 edwardtfn

HA v2024.10.0 will come later today. 😉

Great, then we'll have the next real test tomorrow.

NordFreak avatar Oct 02 '24 08:10 NordFreak

Good morning,

The current situation is as follows:

Yesterday (as you announced) the new core release was published.

The core update was also installed automatically this morning, but the output is incorrect:

I have not received a message about the core installation. Below you can see how I was shown that only the Alexa update was installed.

grafik

Which is unfortunately wrong. Yes, there is a new update, but it has not been installed.

grafik

Systemlog ist clean.

do you need more information ?

unfortunately i don't know the best way to make the whole trace available to you. if that helps you, please tell me the best way to do it.

NordFreak avatar Oct 03 '24 07:10 NordFreak

The challenge is about using the post-update message. It will work fine for updated that won't restart HA, but when an update restarts it automatically, the script is interrupted before the message is sent, then when it restarts that update is not in the list anymore. Have you considered sending the message in the pre-update, then use the post-update only for the pending_updates_list to inform whatever failed?

edwardtfn avatar Oct 03 '24 08:10 edwardtfn

OK, I'll try, but of course it won't be as “beautiful”. I'll report back tomorrow on how the Alexa update has performed.

But I still have two questions:

  1. why has the Alexa update not been installed? The time window was not exhausted.
  2. why am I not getting this message?

grafik

NordFreak avatar Oct 03 '24 08:10 NordFreak

  1. why has the Alexa update not been installed?

Looks like something is broken with that integration: https://community.home-assistant.io/t/psa-alexa-media-player-v4-13-3-breaks-all-versions-of-home-assistant/778171 I would suggest you pausing its update until HA v2024.10.1 is out.

2. why am I not getting this message?

updates_list is a list, while that field expects a string.

Please try this:

message: 'Your custom message {{ updates_list | join(", ") }}'

edwardtfn avatar Oct 03 '24 15:10 edwardtfn

  1. why has the Alexa update not been installed?

Looks like something is broken with that integration: https://community.home-assistant.io/t/psa-alexa-media-player-v4-13-3-breaks-all-versions-of-home-assistant/778171 I would suggest you pausing its update until HA v2024.10.1 is out.

Thanks for the info, I have clicked on skip update. It would be annoying if it didn't work again, I was disturbed long enough ;-)

  1. why am I not getting this message?

updates_list is a list, while that field expects a string.

Please try this:

message: 'Your custom message {{ updates_list | join(", ") }}'

grafik

OK, I have made an adjustment. We'll see more next time. Thank you !

I'll get back to you when there's something new

NordFreak avatar Oct 03 '24 15:10 NordFreak

There is a little news, today the update of Battery Notes has been executed. :-) :-)

I have followed your advice and will now be informed in advance:

image

But unfortunately I did not receive a reboot message again. Set up as follows:

image

The system log is clean and the traces show no errors. I'm just not quite sure which is the part for the reboot notification.

NordFreak avatar Oct 04 '24 12:10 NordFreak

I'm just not quite sure which is the part for the reboot notification.

Home Assistant updated will behave in one of the 3 ways:

  1. Update with no need to reboot
  2. Update with "pending reboot" - The update will be completed during the next reboot
  3. Update with automatic reboot (most of the core updates, like HA core, supervisor, OS, etc.).

For 1, no "Pre-restart actions" will be executed, those will be executed only when an update of type 2 is pending restart and you select in your blueprint to force the restart. However, the updates of type 3 will reboot automatically and we don't have control of that, so most likely that will stop the blueprint abruptly and no further (or pending) actions will be executed, bypassing the Pre-restart actions.

edwardtfn avatar Oct 04 '24 13:10 edwardtfn

OK, thanks for the clarification. Then I would say the issue is closed. The main thing that works now is that the updates are carried out. And I can also live with the notification in advance.

So thank you very much for your time and your work. 👍

NordFreak avatar Oct 04 '24 16:10 NordFreak

@edwardtfn -

Hello, unfortunately I have to get in touch again.

The update has not been working for days, but when I look at the trace I can't find any errors, the script runs without errors according to the trace. In the system logs no error is recognizable for me. What data can I provide or where can I look to find the error?

image

Here are two more of my mail notifications, where you can also see that the script ran, but did not install anything.

image

image

NordFreak avatar Oct 20 '24 07:10 NordFreak

Here is the current status. Unfortunately unchanged.

image

I will now start the update process by hand, please let me know if you want me to pull a new version from git to test.

image

NordFreak avatar Oct 25 '24 06:10 NordFreak

Unfortunately I haven't had a chance to look at this yet. It was a quite busy week, but I will try to find some time this weekend and come back to you.

edwardtfn avatar Oct 25 '24 08:10 edwardtfn

Unfortunately I haven't had a chance to look at this yet. It was a quite busy week, but I will try to find some time this weekend and come back to you.

Thanks for the feedback, I'll update manually again until I hear something new from you. It's really strange that it's not working again.

NordFreak avatar Oct 30 '24 04:10 NordFreak

Unfortunately I haven't had a chance to look at this yet. It was a quite busy week, but I will try to find some time this weekend and come back to you.

Hi @edwardtfn, have you the time to take a closer look? Do you need any more data from me ?

NordFreak avatar Nov 24 '24 00:11 NordFreak

Today I'm quite happy that the automatic update didn't work ;-)

But do you have any idea when you have time for bugfixing ?

NordFreak avatar Dec 05 '24 16:12 NordFreak

Any news ?

NordFreak avatar May 09 '25 14:05 NordFreak

I'm quite advanced with testing a new version that will solve this. I still need to get s bit more confidence in the new code, but I believe I'm quite close to a release. I will keep you updated.

edwardtfn avatar May 09 '25 20:05 edwardtfn

I'm quite advanced with testing a new version that will solve this. I still need to get s bit more confidence in the new code, but I believe I'm quite close to a release. I will keep you updated.

Is there anything new? Or should I just close the issue because no more changes are being made?

NordFreak avatar Jul 23 '25 17:07 NordFreak