I mentioned this yesterday at AIC when Bob was presenting.

Increasingly we have power shutoffs in California because of wild fires and this has motivated me to find some way to safeguard Observatory and equipment in case power goes off. Especially since after power goes off you could have a rain event mucking everything up!

Here's what I have done. I have AAG Cloudwatcher and SkyAlert. Both of these output Boltwood II one line file which is being consumed by ACP via the BoltWood File server.

When either of these weather stations lose power, they basically stop updating the one line file, which is interpreted by ACP as a weather unsafe event (you could look at the BoltwoodFile.wsc to see how). This happens, worst case, after 60 seconds of losing power (that's the update frequency used by BoltWood File server. You could change this, but it should be plenty).

I have powered by Dome, Mount and Camera system through a UPS. The UPS has enough capacity to power everything for 20 minutes after a powerfailure assuming full charge when this happens. Should be plenty to safe guard everything.

So here's what happens:
- If power goes out, weather is marked unsafe
- This is seen by ACP and triggers weather safety script
- In weather safety script you want to differentiate between a power failure and and a normal weather safety event
- To do this, my observatory computer (a Laptop with it's own battery) is NOT powered through the UPS. If there is a power failure it switches from wall power (plugged-in) to battery power
- I detect if laptop is on battery power and if it is, we determine it is a power failure. This is by reading the wmic database:

Code:
function onBatteryPower()
{
    Console.PrintLine("Checking if laptop is on battery power (indicating power failure)...");
    try {
        var mgmtObj = new ActiveXObject("WbemScripting.SWbemLocator").ConnectServer(".","root/CIMV2");
        var x = new Enumerator(mgmtObj.ExecQuery("Select * from Win32_Battery")).item().BatteryStatus;
        if(x == 1) {
            Console.PrintLine("...Laptop is on battery power");
            return true;
        } else {
            Console.PrintLine("...Laptop is NOT on battery power");            
            return false;
        }
    } catch(ex) {
        Console.PrintLine("WMI: " + (ex.message ? ex.message : ex));
        return true;
    }
}
- In the main weather safety routine, first check if it's power failure, if it is, shut everything down similar to what i do in my shutdownobs for the morning (i.e, park mount/dome, warm camera, and turn off power to everything)
- if it is not a power failure, then park mount and close up dome and wait to see to see if weather clears up (similar to the default provided with ACP)

Hope that helps!