Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NordFreak opened this issue Sep 28, 2024 · 23 comments
Labels
bug Something isn't working

Comments

@NordFreak
Copy link

NordFreak commented Sep 28, 2024

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!

@edwardtfn edwardtfn added the bug Something isn't working label Sep 28, 2024
edwardtfn added a commit that referenced this issue Sep 30, 2024
edwardtfn added a commit that referenced this issue Sep 30, 2024
@edwardtfn
Copy link
Owner

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

@NordFreak
Copy link
Author

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
Copy link
Author

NordFreak commented Oct 1, 2024

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
Copy link
Author

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?

@edwardtfn
Copy link
Owner

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
Copy link
Owner

edwardtfn commented Oct 2, 2024

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?).

@NordFreak
Copy link
Author

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.

@edwardtfn
Copy link
Owner

HA v2024.10.0 will come later today. 😉

@NordFreak
Copy link
Author

HA v2024.10.0 will come later today. 😉

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

@NordFreak
Copy link
Author

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.

@edwardtfn
Copy link
Owner

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?

@NordFreak
Copy link
Author

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

@edwardtfn
Copy link
Owner

  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(", ") }}'

@NordFreak
Copy link
Author

  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
Copy link
Author

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.

@edwardtfn
Copy link
Owner

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.

@NordFreak
Copy link
Author

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
Copy link
Author

NordFreak commented Oct 20, 2024

@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

@edwardtfn edwardtfn reopened this Oct 21, 2024
@NordFreak
Copy link
Author

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

@edwardtfn
Copy link
Owner

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.

@NordFreak
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants