The other reason I want a delay is that it seems that sometimes the XTB-IIR and CM15A take a few seconds to "boot up" after power comes on. If the PowerFlash sends its command too soon, they don't hear it.
I've been looking into this a bit more, and I'm going to try using a 555 timer circuit to trigger the PowerFlash after a short delay. If that works the way I want it to, then I should be good to go.
However, I think I may have found another solution.
The PC that I have connected to the CM15A is on a UPS, so it stays on through most of the shorter outages. With Windows 7's Tash Scheduler, I can trigger events based on the UPS power state (running on AC or running on battery). I'm currently using those triggers to send me e-mails to let me know when the ups switches to battery, and back to AC power, which is a pretty good indication of a power outage starting and ending.
I was thinking I could use those same triggers to activate my "power is back on" macros. I could have two scripts that run on the PC (not in AHP), one for power going out, and one when it comes back on. Here's how they would work (this is pseudo-code, not the actual CMD scripts):
Script 1: PowerWentOut (triggered by a switch from AC to Battery)
Copy TempFlag.txt Flag.txt
(this sets a flag, in case power doesn't come back on before the battery gets low enough to shut the PC down)
Script 2: PowerCameBack (triggered by a switch from Battery to AC, AND at system boot-up)
Pause 20 seconds (to allow more than enough time for the XTB-IIR and CM15A to come back online)
If Flag.txt exists, then
Send PLC command M1 On (my trigger address for the macros in the CM15A)
Delete Flag.txt
The flag file is needed in case the outage lasts long enough for the PC to get shut down.
The second script would also run at startup, so if the flag gets set (start of power outage), and doesn't get cleared before the PC shuts down (during the power outage), then the macros will be run when the Pc boots back up (after power is restored).
It is probably not foolproof, but it is good as a backup for the PowerFlash method.
I don't think I'd implement this unless I can't get the 555 timer to work the way I want it to with the PowerFlash.