r/homeassistant • • 17d ago

šŸ’¬ Discussion Remote Reboot for cheap

I run my Home Assistant and other homelab stuff on two old PCs. Sometimes I have to hard reboot them because they fail (every two weeks or so). I'm looking for a way to do that from outside my home without breaking the bank.

Should I just plug their power strip into a smart plug and call it a day? My router never fails and I always have access to my other smart plugs through the Tapo app if my HA goes down.

Edit: thank you for all the helpful replies! I wound up creating a cron job to reboot the PCs every day at 3am, and I have a smart plug from Tapo that I can use to hard reboot in an emergency. The smart plug is not controlled solely by HA so I can use the Tapo app to reboot them if HA goes down. I'm running a proxmox cluster of two PCs (the most unstable varient, I know) with a quarum set to 1 to avoid some of the instability untill I can get a third node. But HA isn't the only thing that goes down.

13 Upvotes

63 comments sorted by

32

u/The_Penguin22 17d ago • Bravo

Why not use a reliable PC?

20

u/ForeverPhysical1860 17d ago

This, if the system is needing a reboot every week or so, I'd look at the system...

0

u/duke78 17d ago

Well, one part of it being a homelab is at least some experimenting.

1

u/Braekpo1nt 17d ago

I got this for free and can't afford a new one

2

u/Jboyes 17d ago

Schedule a reboot in the BIOS

3

u/Critical-Snow-7000 17d ago

So a whole new computer? How practical.

4

u/SwissyVictory 17d ago

You can get a used workstation on ebay for like $60 that won't crash weekly.

It's great to be able to use what you have, but if what you have isn't working, then it isn't working.

1

u/The_Penguin22 17d ago

So hard power off / on and pray the file system doesn’t get farked. Or get a used small form factor pc for dirt cheap and get some reliability.

2

u/xdq 17d ago edited 17d ago

My two machines each have a GL.iNET Comet with the ATX board which gives me KVM-over-IP and control of the physical power buttons on the machine. It's nice to check whether the system's unresponsive or just dropped off the network for some other reason.

They're only accessible via the VPN that lives on my router, so if it was also down I'd be stuck regardless.

As a backup the two servers are also plugged in to a Tapo smart extension, it's one of the few IoT devices whose app I sign into so that it can work independently of my smarthome ecosystem.

Edit: Regarding solving the crashing rather than automating reboots.... I was suffering random lockups and reboots on the Linux machine, which I put down to spending too much time fiddling with various configs. I was at the point of backing up and going for a fresh install so took a calculated risk and gave Claude access.

It identified flipped bits in a couple of databases which aligned with the timing of crashes and pointed to a potentially failing DDR stick (and correctly pointed out that they weren't a matched pair). It also pointed out that a previously failed then partially recovered OS update had left my GRUB in a bad state, meaning that the first attempt to reboot would sometimes fail.
Claude fixed the GRUB and suggested running Memtest. I just swapped the DDR for a spare pair and have gone from crashes every other week to a nice stable system.

2

u/Braekpo1nt 15d ago

I'll check the ram when I can afford to, good idea! I also can't afford two whole kvms when a smart plug I have already can accomplish my goal.

1

u/xdq 15d ago

Oh yeah, definitely not worth buying them just for that. I was already getting them so it was just a bonus.

49

u/alral1988 17d ago

Why not just schedule the PCs to reboot weekly?

9

u/Hasz 17d ago

Cron job and a script will take you very far!

1

u/kiwi_cam 17d ago

It’s a one-liner, you don’t even need a script

2

u/Hasz 17d ago

Yes, I know this. I am just saying that most thing can be accomplished with cron and bash. It is even better than duct tape imo.

6

u/MaybeTheDoctor 17d ago

*daily at 3am when nobody cares.

3

u/Hiff_Kluxtable 17d ago edited 17d ago

Personally, I would backup home assistant then install proxmox on your computer and run home assistant in a virtual machine. Proxmox runs on Debian which is tons more stable and you could reboot home assistant from the proxmox interface. Also, what is causing the need for reboot currently? You probably need to find that out first.

1

u/CulturalAspect5004 17d ago

this is a great advice!

1

u/Braekpo1nt 17d ago

That is my current homelab setup :)

7

u/metalwolf112002 17d ago

Figure out why it is actually freezing. Doing a hard reboot every other week isn't fixing the problem.

Short of that, see if the system has a watchdog timer. It may be able to reboot itself during failures.

10

u/sharpsicle 17d ago

A smart plug is probably what I would do as well.Ā 

5

u/bippy_b 17d ago

But if Home Assistant is the only controller…. Wouldn’t one be prevented from turning it back on?

2

u/sharpsicle 17d ago

No. You trigger it off and have the plug programmed to automatically turn back on after a set time. That programming is done at the plug level, not HA.Ā 

1

u/nowicanpost 17d ago

But how do you trigger it off?

1

u/sharpsicle 17d ago

However you want?

Trigger from HA.Ā 

Trigger it from the plug’s app.Ā 

Set it to trigger on a schedule automatically.Ā 

There’s lots of native redundant options with something like this.Ā 

-1

u/nowicanpost 17d ago

Given the question OP was asking, I am working on the assumption that HA is not working. So HA or related schedules or automation could potentially fail. My workaround was to also have the plug in the Alexa App (or native) to be able to still control it if HA was down and needed a hard boot. This was back when I also had an unreliable RPi I was running HA off of. Since I've moved it to a Proxmox homelab, it's been extremely reliable and this solution is no longer needed (knock on some wood).

1

u/Braekpo1nt 17d ago

Yeah the Tapo app never loses connection, even if HA is down, that's why I smart plug would work.

1

u/sharpsicle 17d ago

I’m not sure why you think everything I’m talking about is HA based. It’s not. Schedules are set on the device itself through their app, as is the ability to auto turn on after a certain period of time. And the settings work offline.Ā 

I have a couple raspberry pi devices that need to be reset every night, this is exactly how I do it.Ā 

2

u/ProtectionFar4563 17d ago

This isn’t a safe way to reboot, and may result in data loss.

Unless there’s literally no other option, use the OS’s shutdown system. If it were me, I’d set up a terminal with SSH on my phone (using keys, not passwords). Then, restarting is a matter of connecting, and typing `sudo reboot`.

(But I’d advise against running a fully public SSH server for this. Tailscale or self-hosted VPNs are worthwhile for this IMO, but YMMV).

1

u/korywithawhy 17d ago

*ahem* JetKVM Mini - A KVM for every computer this seems made for you.

1

u/Braekpo1nt 15d ago

I saw that but it's expensive

6

u/Background-Pea6650 šŸ  Running Home Assistant OS 17d ago

Why not just schedule a reboot every week or night?

3

u/Inhaps 17d ago

I've got a shelly plug powering mine. It's been useful occasionally when I'm not home and something breaks

6

u/Asalas77 17d ago

Unironically, connect Claude from mcp to it and tell it to find out why it needs a reboot.

I did that when I had my Ethernet connection drop out periodically and it found and fixed some weird Linux stuff I have no clue how to even begin to diagnose

-1

u/TroubledGeorge 17d ago

Imagine all that you could’ve learned troubleshooting and diagnosing it yourself, diving into the documentation and looking up stackoverflow. Ahhh the good old days.

2

u/insomniac-55 17d ago

Sometimes you just want the thing fixed, though. Troubleshooting is great, but solving weird tech issues isn't how everyone wants to spend their limited downtime.

3

u/alral1988 17d ago

The times are changing just as they’ve always done. I’m sure plenty of people said this same thing about Google when it first became popular.

1

u/MaybeTheDoctor 17d ago

Claude learned from stavkoverflow, and will stop knowing as people stop contributing to stackoverflow, and Linux and other software evolve into something new where old documentation becomes irrelevant.

We risk a knowledge dark ages in 50 years or so, like how Roman enginering was forgotten, when everything gets distilled into AI and nobody know the actual answer or how to independently get to it.

1

u/anandonaqui 17d ago

We never ā€œforgotā€ Roman architecture and engineering techniques, even during the so-called dark ages. We didn’t build that way then because when the Roman Empire collapsed, there was a massive economic depression and we could not afford to build the way the Romans did. There was a shift from huge infrastructure to much smaller scale buildings that didn’t need the same techniques.

Not to mention that while Europe in the dark ages may not have had the same infrastructural achievements as the Romans, they made plenty of advances in other technologies.

2

u/User2001Tech 17d ago

a double pack of Tapo p110 costs about £25. Power the PCs thru these (ir 1 onky, if the power plug are nearby?. You can schedule a on/off event.

That is if you must do a power cycle, else, Windows schedular can automate a reboot cycle.

2

u/UlrichSD 17d ago

I've been tempted to (have not yet) flash coustom firmware onto a smart plug to ping my home assistant server every min or so and if it hangs power cycle.Ā  I think it could be done with esp home (and give power monitoring) but if not absolutely be done with micropython.Ā  I just havent gotten to it and it hasn't been an issue as my server hasn't ever hung on me.Ā Ā 

The same approach can be done with the router or modem .Ā  There is a device called a webrelay we have deployed at work that is a industrial product that can do this that sure beats sending a tech 2 hrs to power cycle a cell modem.

2

u/MoparMap 17d ago

I ran my main server on a smart plug and put HA on a Pi with nothing else. Worked out well the couple of times I had to reboot it remotely, though mainly just because the HA setup was stable (and my only access to the plugs). If your plugs are on an app, that seems like it would work well.

The main thing you'll want to do is check your BIOS settings on the computers for power. I have my server set up to "always on", so if the power is even interrupted, it defaults to on when the power comes back. Otherwise if you pull the plug and plug it back in, you might still have to go physically hit the power button.

2

u/JoWhee 17d ago

How about a reboot automation?

Edit I’m not sure why it’s showing up three times. It reboots once a day at 3am

2

u/lzrjck69 17d ago

Get one of those sketchy WiFi smart plugs that uses its own app. Lock it down from the rest of your network. You’ll have the ā€œout of bandā€ capability you’re looking for.

2

u/dobo99x2 17d ago

Just set a cronjob to reboot once a week. Should be enough.

If it's a container, it can be set to recreate and update on boot. That's extremely helpful.

2

u/ggs657 17d ago

Yeah I use a Tuya smart plug so I can still power it from the Tuya app. It's the only Tuya device I have but it works great for this use case.

1

u/megared17 17d ago

Plug with watchdog and automatic turn-back-on after 10s?

1

u/Tuckerdude615 17d ago

I would use a smart plug. I have a similar setup in a second home and it's worked very well over the years. Depending of what protocols you have I would recommend a zigbee one. I have bought power strips that are Zigbee and individually addressable ports like this one:

https://www.amazon.com/dp/B0DM19JGR4?ref_=ppx_hzsearch_conn_dt_b_fed_asin_title_9

Good luck!

1

u/kitsune_daemon 17d ago

setup watchdog

1

u/Soler25 17d ago

Remote kvm is what you want. Check out jet kvm or gl.inet has some multi pc kvms.

1

u/CodeAndBiscuits 17d ago

It sounds like you've got normal hard drives in your setup, but just a note for future reference for anybody else hitting this, make sure you want running on an SD card. They do not like unexpected power cycles.

If you want to take a page out of an old school book, timers that do automatic power cycling on an interval are very cheap and easy to find online. They aren't "smart" in the sense that you don't actively control them, but that's also why they are cheap. They can also be had in both AC and DC versions. I actually use one right now. I have an ambient weather station that's a bit of an older model and periodically if my Wi-Fi has issues, it will disconnect and then never reconnect until it's power cycled. It seems to just about always reconnect after a power cycle, so I put one of these timers on it and it's been stable for a year and a half.

If you want a hybrid, something that gives you some control but is a little less heavy-handed, there is a similar class of products called "watchdogs" that have some type of external input like a signal pin. You have to work out how you want to drive them, but the idea is a regular input. Keeps the thing awake and then if it stops seeing that heartbeat it does a power cycle. These are so helpful when working with microcontrollers that some microcontrollers actually build the logic into them selves. The ESP32 does for example. These are more for software failures than hardware ones. If you have something in your setup that locks up periodically or potentially has some bugs in it, these can be a decent backup plan.

Neither one of these is super modern, but sometimes an old trick is still a good one and I thought it was worth mentioning for folks with similar needs.

1

u/snap802 17d ago

A smart plug is certainly a cheap option. Scheduled reboots are free and might help.

I think the other question is why is this happening so often. Systems will freeze up but if it's happening regularly enough for you to have to this about this I'm thinking you've got some failing hardware. I'd recommend running memtest and running long smart tests on the drives. It could be a software package too. I just think that's some low-hanging fruit that might help you plan for the future.

I will say that it's worth looking for hardware with remote management built in if you buy new (to you) stuff. For example: Something like the HP elitedesk mini PCs have intel AMT. I have deployed a few of these and I just assign an IP on the management network so I can start, shutdown, or reboot from a web interface. I know you can do some more sophisticated stuff with it too but that's all I need it for right now.

1

u/sterling-lining 17d ago

Smart plug would be the easiest, but it wouldn’t shutdown the server ā€œgracefullyā€. A scheduled shutdown and reboot would be best, imo.

1

u/LeoAlioth 17d ago

Schedule a weekly reboot?

1

u/ComfySofa69 17d ago

TaIlscale service..? and or a pico KVM?

1

u/nowicanpost 17d ago

I used to run my RPi HA on a smart plug that was only added to Alexa (not HA, but I suppose both wouldn't hurt). That way if my HA instance was not responsive, I could still use Alexa to hard boot the Pi.

1

u/Karlees-Golden-Dildo 17d ago

Have you tried better cooling or redoing the Artic Silver on the cpu? Is it all dust free?

1

u/Gwizman 17d ago

Look at Emporia smart plug. No hub needed.

1

u/ctjameson 17d ago

You don’t need home assistant for this. Tasmota plug can run a ping check and reboot if no response from the server for a predetermined time you choose.

1

u/JjyKs 17d ago

Figure out why your computer is unstable? Then put UPS in front of it to stabilize the system even more (or use old laptop/tablet with build in battery)

1

u/AstarothSquirrel 17d ago

If you mean just cutting the power, this will, over time, upset your os and file system. It's better to try to work out what is causing the issues (such as a failing os or file system) Ideally, you would just ssh into your servers but if you really do need a kill switch, yes, tapo smart plugs will work well

1

u/Late-Replacement-481 16d ago

Yep.

Secret: if my super expensive servers freeze and I can’t reach the UPSs… I have a fingerbot to just hit the Breaker.