0

TL;DR: I need a cheap and simple way to run script on PC whenever there is a power cut.

I have a high power desktop, and APC UPS (BR1500VA). I live in a city with about 1 power outage every day, for about 1 hour. The UPS makes huge noise when that happens, and by default it puts PC to hibernate if I am away. I have 32GB RAM, and windows installed on SSD, and I think hibernation is a bad (and very slow) idea. Also, when I come back and turn PC on, the UPS makes fan noise for very long time, because it is charging, because of the power it lost during the slow hibernation. Shutting PC down is not good because my work sessions take long to open after boot. I usually put my PC to sleep when I am away. So I am thinking to plug my UPS into my house battery backup. PC will get power form UPS, which will get power from house backup. The house backup cannot take the load of my running PC, it will dim all the lights in the house or maybe shut down for a minute. All I need is a way to send an automatic signal to the PC about power outage, and then my PC will go into sleep mode. It will use about 10 Watts while it sleeps, and the UPS might ask for 11 watts. At this point the house backup will become happy and it will give 11 watts to the UPS as long as it can. Offcourse when the house backup runs out of battery, it will shut down, and UPS will hibernate the PC, that is too rare to occur.

I just need a cheap and reliable way to send the signal to my PC. On receiving the signal, I want to run a script that will put my PC into sleep if I am away. Or put it into low power mode so that I can continue working.

3
  • Are you running any APC software? Are there any windows events generated in the event log?
    – DavidPostill
    Commented Jan 14, 2017 at 21:39
  • I'm using APC power-chute (personal edition) software. But I dont want any signal coming from the UPS, because if house' power backup is working good, the UPS wont even notice the power cut. I was thinking to plug something into mains (that is not connected from house's power backup) that goes off as soon as there is power cut.
    – user257838
    Commented Jan 14, 2017 at 21:57
  • Ah. Then I don't have an answer for you ...
    – DavidPostill
    Commented Jan 14, 2017 at 22:09

1 Answer 1

0

This question is really broad as there are number of ways to solve this. If you have a spare router lying around, plug it into the mains socket (the one that is without the power backup). When the power goes off, the wifi router will stop. This can be detected using following command (it shows available wireless networks).

netsh wlan show networks

Refer this post to force refresh the list if needed. You can refer this link to switch the power plan after you detect power cut. You can also change the power plan back when wifi router is visible again. You can edit power saver plan in the control panel so that the PC sleeps after 1 minute of being idle. If you have multiple desktops (like in home office), all of them will get this signal.

You must log in to answer this question.