Integration resilience after power surge (for internet depending integrations)

Hey all!

I’ve wondered how to improve the resilience of Home Assistant after a power surge.

I’m using HA as an alarm clock, but I noticed that the google calendar integration didn’t load after the server rebooted and because of that the alarm clock automation didn’t work:

  1. Server with HA restarts because of power surge
  2. Google Calendar integration can’t load calendars because the router didn’t reestablish the internet connection fast enough
  3. The calendar is empty
  4. My automations don’t trigger

I would’ve expected that the calendars get cached and show the events even when HA starts when there’s no internet connection.

Do you have a tip on what to do in the event of a power surge?

Thanks!

How do you run HA on your server? In several hypervisors you can schedule the power on, set it to wait for 5 minutes for example.

You could also set up an automation that reloads the Google calendar integration after 5 minutes of uptime on HA has passed.

Get a UPS to power HA and your router.

1 Like

I’m running Home Assistant Core in a Python virtual environment. I don’t want to delay the start of HA because 95 % of integrations are local and I want to use it as soon as possible after a (unexpected) reboot.

I wouldn’t want to reload the integration after every reboot, because it happens only 2-3 times a year. But maybe I could check after reboot if the internet connection is online (via the fritz integration) and if it’s not, I could restart the google integration after it comes back online.

Getting a UPS for the server could be a mid-term solution for the server. But I’m not sure if the DSL keeps working after a power loss of the whole area.

You won’t be able to do anything about that. But

1 its bad for your HA box to crash like that. One day it flat out won’t come back that’s a fact. Bad restarts corrupt disks. Ups prevents it

2 most DSL /cable broadband will keep on trucking on the head end because they absolutely have thier end under UPS coverage and it’s different power circuits.
(and honestly, if they don’t you want another broadband provider)

You need a ups regardless if you try to fix the other issue or not. And I strongly suspect when you put the ups in the other problem magically goes away.

So fix the problem you know you have or the problem that might be fixed as a side effect of the other problem you have to fix… :thinking:

I know what I’d do.

Yeah, you’re right. I will look into purchasing a UPS.

Thanks!

1 Like