Using ESPhome to detect if a computer is on

True! We are actually just guessing and trying to fill in blanks. :slight_smile:

In very rare cases do you need the USB power when the computer is off.
It’s handy as a charger, but that is usually all it does.
So I believe turning of this setting if it is on in the bios of this computer is ok given he is not even there.

Sorry for the delayed response. Looks like I need to provide more info.

  • This is a headless Windows 10 computer that only runs Blue Iris to monitor security cameras.
  • It is always on (or at least should be) and set to never sleep
  • Sometimes, the computer turns off. I’m not sure if it loses power too long, someone accidentally turns it off, or why it turns off. It doesn’t happen too often, so why it turns off is not a concern of mine right now.
  • It is on a UPS, but the UPS will only run it for about 10 minutes without power. Just enough to shut it down or for quick power blips.
  • The computer is connected to the internet via Ethernet but is at one of my offices that is 30 minutes away from my main office. I don’t go to this office very often
  • I do not have Home Assistant at this office. I’m considering using a ESP Home device stand-alon and not tied into HA.

I’m thinking I could use a Wemos D1 Mini powered by a USB wall plug. Then use a 5V optocoupler hooked to the Wemos D1 Mini and plugged into one of the computer’s USB ports to detect if the computer turns off. Then use a relay connected to the Wemos D1 Mini and then tapped into the computer momentary “on” button wires to simulate a button press by turning the relay on then off quickly.

It seems like this would work, right?

1 Like

Have you checked the batteries in the UPS?
Or if it has a log, then for events about power failure?

Im suspicious by nature. A device to monitor cameras which should never be off is turning off. My Spidey sense is tingling.

Im not concerned with solving the problem of the computer turning off. It’s a non-critical item for me and the number of times it turns off is minimal. I just want an easy way to turn it back on that doesnt involve an hour long round trip.

Doesn’t your Windows 10 machine send out the Bluetooth Microsoft Advertising Beacon, which you should be able to pick up with an ESP32 an the BLE version (esp32dev-ble binary) of OpenMQTTGateway installed, which in turn could then publish to a net/remote MQTT broker for you to pick up from home.

Not quite ESPHome, but still with an ESP32 :wink:

1 Like

Put a cloud-controlled WiFi smart plug with metering on it and set the BIOS to restart on power failures.

This is the easiest solution. The only reason it wouldn’t work is if the power is out or the internet is down. I’m using a Sonoff S31TPB with the eWeLink app to power-cycle my HA NUC.

That should be the FIRST thing you fix. Computer off and power off are two different things.

But, in this game of 20-questions you have provided a little more information.

How do you know the power is off? Take us through the typical scenario- You detect that the power is off. How? You then drive to the office and the computer is off, or the power is off?

You really need to know why.
Does this only happen overnight? Never during the day?
How often does this happen?
Have you checked the BIOS to see if there is a power-on setting that determines what the computer does when power is restored? (That alone could “solve” your problem).

If the power is out, then you probably do not want to power up the computer anyway.
If the computer have WoL, then use a RPi and set it to send a WoL package each minute or so.

Anyone familiar with these remote PCI cards, seems to do what is needed?

The above is an ESPHome config for them, I have never used.

Not familiar but just ordered some. When we travel, I have to leave my PC on in order to access it from somewhere else. If I can turn it on remotely, then I won’t have to do that anymore.

When I used a PC as server in past I could wake it by WOL when I was away. I used a RPI zero as VPN and could send the magic packet from the RPI.

The most effective solution would be to use a smart plug to monitor power consumption. If the power reading is 0, it indicates that the PC is off, while any value above 0 confirms that the PC is running. To power it back on, a SwitchBot Bot or Fingerbot can be positioned on the PC’s power button to physically press it when needed.

ping your pc… with device_tracker ; home or not home …

Keep in mind this is neither switchbot bot or fingerbot or device tracker exist or will work without HA.
OP said this was a remote location without HA.