HA will stop working after power surge

I have this problem for a while but recently I found the cause to it. Here is my set up and the problem.

I run HA on VirtualBox with an laptop to control the lights and sensor in my home. The laptop power plug in to keep it running all the time. It is wired connection to the router with a cable too. The router has its own ups.

Rarely, HA would not work and I have to restart it in the VirtualBox and then it will work again. Recently, I found out that when there is a power surge, it will stop working.

The laptop is plugged in and the battery is healthy.

This morning the power surged again and HA stopped working. I restarted it and it was backed on.

I try to mimic the problem by unplug the power cord on Laptop and plug it back on, but it does not do anything, the HA is still working without problem.

I unplugged the ethernet cable too, but HA keeps working like nothing happened.

What should I do to solve this annoying problem.

Thank you.

Plug the laptop into the UPS, since those usually have surge protection

Spikes and surges can considerably shorten the working life of your power supply components, leading to unreliable operation. The role of the UPS should also be to smooth these out during normal operation, not just when the power is cut. The sacrificial surge protectors (MOVs - metal oxide varistor) inside will eventually break down, hence you see lots of discarded UPSs where the batteries still have life left in them. If you disassemble a power supply, you will find these as a blue disc the size of your fingernail, often close to the fuse and where the mains power enters. Unless you have had a major surge such as a lightning hit, they will not be charred and black if they are damaged, as their sacrifice goes on, absorbing spikes less and less during their life. It is not normal maintenance procedure to replace these regularly, the cost of labor being far more than the cost of the MOV. The UPS is discarded and a new one takes its place. The projected lifetime is not a marketing ploy by the UPS manufacturer, but a reliable estimate of field conditions and protection offered. Five years is a common life, usually involving one replacement set of new batteries.

How old is your UPS?

Is your power surge traveling through your connecting cables such as Ethernet? An earth loop?
The laptop by default acts a battery backed UPS too. Maybe put it on the same circuit as the UPS and router, and the voltages will then be stable, the laptop battery still working as its own UPS once the router one gives out.

The laptop power supply should also have some surge suppression MOVs too, and they may have broken down as well, letting spikes through. How old is the laptop power supply?

Are your power surges short spikes or brownouts over a longer period of a few seconds? Maybe a surge protected power board that also has MOV protection for USB and Ethernet ports may be a option. These are often built into UPS devices too.

Contact your power company and check if yours is an isolated situation, or if it is common in your area. They have sensitive monitoring equipment they can install on your premises for a extended period such as a week or month that can analyze the extent of the problem. Are your neighbors experiencing similar problems? Is there a faulty street power transformer close by? Do you have external power lines that have tree branches rubbing against them causing power surges and possible fire hazard? Is your household voltage too low, at the end of a long power line, or worse, close to the transformer and very high? They should be able to tell you and offer remedies.

Also have your power distribution board (where the meter is) checked for any poor connections, especially for the common neutral link that can cause brownouts and voltage fluctuations. If living close to the ocean, salt corrosion in the air can often makes these unreliable. Your electrician should be able to advise the appropriate remedies - whether a airtight barrier or spray or just regular tightening of the connectors may be preventative maintenance.

So short term suggestion: Plug your laptop into your UPS that powers your router. Does that solve the problem?
Do the other checks anyway, as the UPS is only masking the underlying issue.

Have you considered surge protection at the main and sub panels? If you are in a place that uses A/C, has the capacitor on the condenser gone bad? I had to put surge protection on all of my panels and sub-panels to stop burning up z-wave devices. The in-rush current can be huge on a 5 ton A/C and you can consider a soft start device on the A/C to lower it. You might also want to check your grounding.

Based on what?

Right now all I see is it stops. Sure surge could be an issue but usually the entire machine is interrupted. So apology I’m more than skeptical on the cause. What is the proof it’s caused by surge.

I also see VirtualBox. Which is known to have other issues. So. How do we know it’s a surge?

If you don’t have that then you need to investigate the cause of the hang…

Thank you for such a detalied reply.

In my area, when there is a big storm, it will probably cause a power out for few minutes or some time half hour. It also short spikes some time like a second or two.

The UPS is about 5 years old, so the laptop.

I will try to connect the laptop to the UPS.

See my previous and if it’s truly that bad. Nothing will help EXCEPT surge suppression and id go whole home.

Thanks for the reply.

It has been like this for about 1 year. At begining, I did not know what was the cause to it. So, I just restart the Virtual Box and then it worked again. I thought it was the software update or something like that.

Recently, as the storm hits few time in the summer and caused few power outage and surge, I found out each time when the power was out or surged, the HA or Virtual BOX would stop working or having issue.

This morning, it surged again and I checked HA, not working. It was working as expected before for the light just 1 minutes before the surge. So that is why I guess it may be related to the problem.

Thank you for the reply, I am going to check the surge protection. I thought my electricity panel have it.

Yes sir, I am going to do it.

Maybe the surge protector MOVs have reached the end of their useful little lives. Put a cheap surge protector in front of it to extend the life of the UPS and your laptop.

Whole of house protection sounds good, but talk to your power company first, as they may be able to offer you some spike protection too, your surges probably coming from their end too.

Since HA is in a VM it is surely not affected directly by the power problems, you can investigate further to see in which state is the underlying VM and OS after the event, is HAOS running or frozen/hanged before you forcibly rebooted?

If the VM hanged see what you can find in the laptop OS logs and power saving settings.

another test could be to run a small parallel VM with a light linux distro to see if it also hang freezes in these conditions.