I have a server running Blue Iris at a remote office. For some reason, it sometimes shuts off, or is shut off, randomly. Id like to build an ESPhome device that monitors the computer, knows when its shut off, then triggers a relay that I’ll tap into the power button wires to turn the computer on.
Any ideas on how to monitor that the computer is turned on? If it helps, the computer is set to never sleep.
Well you don’t need an ESP to report the state as it exists some softwares you can install on the computer that repots at HA. I have one running here on my desktop linux that is GitHub - hjelev/rpi-mqtt-monitor: Raspberry Pi MQTT Monitor gathers system information and sends it to a MQTT server. (I work on Linux) and I’m quite sure something equivalent for windows if needed
If it’s a proper server hardware doesn’t it have IPMI ? IPMI have some API that allowr lot of things including power on/off, soft reboot…
It’s not a proper server, just a Windows 10 machine running Blue Iris.
I don’t have a Home Assistant installation at the remote location. I was hoping to just have a stand-alone ESP device installed on the computer that would detect the computer shut down then turn it back on.
Are you sure that it’s not someone pulling out the power cord to use the power outlet for something else? E.g. a vacuum cleaner?
Happened to me once at university (long ago) where some “ordinary” looking PCs where located in an otherwise empty (small) office. But they were servers which ran 24/7.
You can most likely use a USB cable in one of the USB ports and have a voltage divider so that the EAP can sense ot safely.
I have this on my son’s TV and it works fine.
Not sure though how this should trigger the smart plug.
But you could have a ESP-Home flashed smart plug and just a couple of wires to the USB port on the computer.
A smart plug with power monitoring can be used to track the current draw—if it drops to 0A, the PC is off, triggering a power-on action. Another approach is using a USB-connected ESP; if it becomes unavailable, it indicates the PC is off and needs to be turned on. Alternatively, a network-based tracker can ping the PC’s IP address to determine its status. Once any of these detection methods is set up, a small relay module connected to an ESP can be used to simulate a power button press and turn the PC on.
The smart plug with power monitoring initially sounds like half the solution. But there’s some things to be mindful of there though that make me more hesitant.
It could reset/restart itself, so it could interrupt power to the server. Especially without (but even after) proper configuration. They also tend to be hard / illegal to break out extra gpios from for extra kit like relays. And you’re dealing with the high voltage side. These devices are also notoriously unreliable and prone to failure.
I’m liking the idea of monitoring the power via one of it’s usb ports. That way you’re just dealing with low voltage.
Power the esp separately via wall wart. Add your relay button press kit. Build the whole thing so it works locally offline (although that makes it hard to test /debug).
That’s all assuming you only need to do hard reset via your button press and don’t need to actually switch power from the wall.
Disclaimer: I’m by no means advanced on these areas so take my thoughts with a pinch of salt.
Edit: Hmm thinking more about it maybe monitoring the usb power isn’t going to tell you if it is “shut-off”…
I think smart plug with power monitoring is a good approach. Ive been using several for 4 1/2 years and no problem. I use tasmota on them. Its uptime will tell HA if power had failed to the socket or has been unplugged. The button on it will report if its been switched off by hand. You can restart it from HA using automation.
Have you suspicion its being deliberately turned off?
First, is the computer OFF or sleeping? You need to determine HOW it is turning off. The reason will determine the fix. Do people at the remote office just notice the computer is off and they press the power button? Is there some kind of power interruption overnight?
Is the BIOS power-on state set to restart after a power fail?