Intel NUC Power Failure - Trouble Restarting HA

I’ve had a problem for quite some time now when I have a power cut, Home Assistant does not restart properly (running HAOS on NUC). I have changed the bios settings to power on after power failure which the NUC seems to do every time however HA is inaccessible until I go and manually push the restart button on the NUC. Only thing I can think of is that the NUC starts up before my internet is back online which causes a problem starting HA.

After having multiple power cuts through the night I’ve had enough and need some help figuring out what to do. I’ve just done a test to “simulate” a power cut i.e unplugged the NUC while power/internet has been up for a while and sure enough it powers back on and HA starts very quickly with no problems.

First thing that comes to mind is setting a delay so the NUC starts up a short time after a power cut, but I’ve got no idea how to go about this. How do you make an automation run when all your hardware is offline? :upside_down_face:

Are these long term power outages? maybe power is just low so unit never completely shut down

Definitely a UPS is needed. Look at nut sensor as well. I think a UPS will solve this issue. Only run NUC on ups.

Power outages usually last for 1-4 hours on average but in rare cases could be only a few minutes to 8+ hours, how long is a piece of string type deal. UPS would be a great idea but if I had one I probably wouldn’t use it on my NUC as I’d rather protect hard drives or NVR system instead and also can’t really justify the cost of a UPS as it would probably exceed the value of the NUC. Thanks for the suggestion though, I may look into it in the future if I can’t figure anything else out.

I don’t know for your country, but in mine used UPS devices are dirt cheap - i can get used model for price range of 50-80€ (power from 0.6 to 1kVA). Look for model with one battery and then just add (used, but still good) car battery and you’re done. I have 2-4 hours of reserve for my internet modem, router, syno nas and nuc with one 50Ah car battery. At the end you should connect modem and/or router to UPS, too, so that you have a working HA from outside world, right?

Remember it’s a sort of linux, and linux specifically hates being powered down wrong way…

Can you afford not to have a UPS?

Can you ping your NUC/HA on network once it boots? Do you have static IP on your NUC or do you use static/dynamic allocation from DHCP?
You should be able to simulate this behavior, right? Just cut the power and bring it back. Does this happen every single time? When you attach monitor, is your HA fully started? Or maybe you are stuck at some point?

Invest in an UPS and have the NUC as well as your core networking gear where it is at connected to the UPS, exceeding the value of the devices is not an excuse, you have a problem and this is the solution until you have stable power from your provider.

I use a NUC but I have a headless instance in virtualbox that is set to boot up even if I am not logged into it since I also use my NUC to keep the camera feed up from my NAS.

To use NUT sensors for an UPS make sure to connect the UPS to a device that can act as a server to allow it’s data to be seen in HA, in my case I use my NAS as the server via the data cable to manage when to shut it and the gear off when time left on the UPS hits a critical point.

The only time I need to have HA restart other than updates is via an automation I setup for 6am/6pm to refresh the connection to my fujitsu AC system.

I expect the NUC is not fully powering off. If it happens again i suggest connect to command line and check running state.

Not fully powering off? After 8 hours without power?

Interesting idea although my NUC is located away from all my other networking gear due to a rf range issue with one of my end devices. I am working on something to negate the need for this device so may be able to move it to same location soon, but not sure if I’m on board with the car battery idea for 2 reasons - 1 being safety around a lead acid battery inside a closed cupboard with a lot of electrical gear, and 2 being that the battery would only give 2-4 hours run time which means in my case this is only going to be reliable maybe 80% of the time as the battery won’t last long enough on some occasions.

It only just occurred to me that I have satellite internet and if I power the modem/router I’ll still have internet? But for my instance I’d need to power a 24 port switch, starlink modem, orbi router (but the mesh units would not get power obviously which leaves some devices not connected and wifi range limited) and NUC as a minimum, but is almost just as important to also run my NAS and NVR as well (but mainly just to shutdown safely), so I’m guessing I would need a substantial UPS or battery. I still don’t really think it’s worthwhile having HA without power because most end devices are rendered useless without power… At the end of the day I’m fine with everything going offline during a power cut, I’m just trying to get everything to come back online by itself afterwards. If a UPS is for certain the only way to achieve this then I have a bit to think about.

Yes static IP. Are you suggesting to unplug the NUC and router and plug in at the same time to simulate the power outage? I’ll try this and ping/monitor when I move my NUC back to network cupboard.

Wasnt sure if issue was no power or Low Power (brown out). I live in area where brown out was common and resulted in similar problems where when power fully restored it was necessary to power cycle equipment to clear issues.

Man, it seems that you really live in “power problematic” place… if power outages are so frequent and long, i’d start to think about installing solar panels on the roof… but that’s another (expensive) story…

You might like to think about a device like a pi zero, write a monitor that tests if ha is up, and if it isn’t for 5 minutes, ssh to the ha machine and reboot.

Great idea! This is exactly what I was trying to achieve just didn’t know how it could be done. I had it mostly figured out and ready to set up on a d1 mini, but got stopped in my tracks when I connected the NUC to a monitor and seen a problem while it was booting

It seemed to get stuck here and was inaccessible with ssh so I had a look through some bios settings and ended up enabling legacy boot mode which fixed the problem. I recall seeing somewhere that UEFI boot mode was necessary for HA but it seems to work fine (for now).

In the logs as the NUC boots up there is quite a difference when the internet is on vs when off. If I restart the NUC it shows about 10 seconds of logs on screen and then goes to to the big Home Assistant startup logo which gets up and going in less than 1 minute. However if I simulate a power cut and turn off my modem, router and NUC and then turn all back on there are a ton more logs showing on the screen (or maybe there are the same amount the process just takes longer to get completed as the internet comes back on). I did see a couple of things revert to FAIL instead of OK but it still seems to start up fine and the timer shows around 3 mins before going to the HA logo, presumably the time it takes for my internet to come back online.

Stupid question, but do you have the latest/greatest BIOS loaded on the NUC? Older BIOS could mean issues in certain situations on certain boards.

1 Like

Update the BIOS and check that proper settings are applied then retest to see if the same situation occurs for that nuc model you have, I would also replace the CMOS battery for it whilst having it open as well.

I did end up following yours and @FredTheFrog advice and updating the bios from AYAPLCEL:86A.0070.2021.0901.1556 to AYAPLCEL:86A.0075.2023.0510.1721 and it ended up breaking HA. I had to reflash ssd and upload a backup which ended up being a real PITA as a lot needed fixing to get HA back to where it was. Anyway, tried simulating the power cut again and got the same POST error as before. I tried a bios setting to skip keyboard press after 5 seconds on a POST error and carry on with startup but it still just hangs there.

I had a look into changing the CMOS battery but I don’t have another one on hand and looked like a prick of a job, also “if it’s not broken, don’t fix it” sprung to mind. Could see myself getting into trouble disassembling the NUC, but I will have a go if someone can explain why it might be a serious issue not to replace it.

1 Like

Buy a simple UPS and have the NUC perform a controlled shutdown when the UPS battery is at 10%. Uncontrolled shutdowns need to be avoided.

How does the NUC do the shutdown at 10% - would this be an automation in HA to initiate the shutdown via ssh or something? Or is it a capability of the UPS/NUC itself? As you can probably tell I have no experience with UPS.

Get a UPS which is compatible with NUT.

Install the NUT addon and the NUT integration.

You get sensors on how much battery you have left. Do an automation so that when it goes below 10%, run the hassio.host_shutdown service.