Page 1 of 2

Recovery after power failure

PostPosted: Tue Feb 16, 2021 4:48 am
by kw123
With the recent disaster in Tx I would to get a working solution to restart mac and indigo after power failure

Here the main challenge
- Mac OS does not restart when power is back when shutdown gracefully

With an apc you have the opportunity to get a signal when in battery / less then x energy left ..
then you can decide to shutdown the mac.
But then when power comes back the mac does not restart.

One could stop indigo and let the the mac crash at the end of power so that it restarts
- not the preferred solution
And when the power comes back before the battery is drained indigo does not know it should restart.

Here my qs:
- Does a wol package wake a mac or how YI configure it
- How to start indigo from the command line
- has anyone solved this or any other ideas?

Karl


Sent from my iPhone using Tapatalk

Re: Recovery after power failure

PostPosted: Tue Feb 16, 2021 8:14 am
by Different Computers
A less than complete answer is to use Energy Saver Preferences to start the mac at a set time each day. That's less than optimal because if the power goes 3 minutes after the daily start schedule it won't boot up until tomorrow, but it's, excuse the pun, a start.

https://techviral.net/schedule-startup-shutdown-on-mac/

As for starting Indigo, can you have auto-login enabled? If so, then just configure Indigo server to start on login.

Recovery after power failure

PostPosted: Tue Feb 16, 2021 8:20 am
by kw123
I remember. And you could set it in a command every 5 minutes to now+2 hours.

But that also is bad if the power outage lasts 2hours and 5 minutes.


Sent from my iPhone using Tapatalk

Re: Recovery after power failure

PostPosted: Tue Feb 16, 2021 10:53 am
by yassi
What about putting a SwitchBot on the power button (if the Mac model allows it) and restart it “manually”?


Gesendet von iPhone mit Tapatalk

Re: Recovery after power failure

PostPosted: Tue Feb 16, 2021 4:25 pm
by agame
i'm running indigo at a remote location with unreliable mains power, so tried unsuccessfully for a long time to find a solution to this - my compromise [pending a whole of house battery being cost-effective] is a UPS to cover typical outages but allow a hard shutdown at in the end.

It does occur to me it would be possible to partly soften the shutdown by eg unmounting drives just before the shutdown hits (and reversing if mains power returns) but have never put in the effort.

Pre-indigo i used a telephone-line actuated relay to remotely reboot when required various 12-volt network appliances including a Vera unit. Small DTMF driven relays are readily available for this purpose [but i assume require a traditional POTS landline?]. It worked really well.

Re: Recovery after power failure

PostPosted: Tue Feb 16, 2021 4:34 pm
by kw123
works, just tested, soft shutdown of indigo mac server (mojave)
then in terminal on an rpi:
wakeonlan 40:6c:8f:bc:19:ed (that is the mac number of my indigo mac )
and mac came back up

So here a possible setup:

indigo shutsdown at 10% bat left, then the mac shuts down

On an RPi that goes up/down w power

run the script (symbolic):
Code: Select all
lastOk = time.time()
while true:
  if testpin(ipofmac): # test if mac server answers ping
   lastOk = time.time()
   continue
 if time.time () - lastok > 300 secs # every 5 minutes
    subprocess.popen("wakeonlan mac#of indigoserver", shell=true)
    lastOk = time.time()


that should do it. will test

Karl

Re: Recovery after power failure

PostPosted: Tue Feb 16, 2021 6:11 pm
by agame
great idea...which reminded me of an old vera i use to run a device that won't talk to indigo. I can use the Vera WOL plugin to do the same.

Re: Recovery after power failure

PostPosted: Tue Feb 16, 2021 6:16 pm
by kw123
it only worked once. the second time i tried it nothing happened.. mac stayed off :(

need to dig deeper

Re: Recovery after power failure

PostPosted: Tue Feb 16, 2021 9:40 pm
by kw123
It looks like the mac has to be in sleep mode not in power off mode tor wol to work. That might also depend on the type of mac: Mac Pro, mac book, Mac mini ...


Sent from my iPhone using Tapatalk

Re: Recovery after power failure

PostPosted: Wed Feb 17, 2021 4:01 am
by agame
damn.

Re: Recovery after power failure

PostPosted: Wed Feb 17, 2021 11:24 am
by McJohn
Nice and interesting thread!
We are using an APC 650 UPS for ~10 years now (with the UPS and Battery monitor Plugin).
In 7 of 8 times of a power failure in 10 years it does what is has to do: continuously and stable provide the power for almost an hour.
So, you have also to calculate the risk how many times this (big) problem of a loooong power failure happens?

This one is for you Karl:
https://www.youtube.com/watch?v=GKyLJRs5Q3k
:D

Re: Recovery after power failure

PostPosted: Wed Feb 17, 2021 1:38 pm
by kw123
And I really like the Italian.


Sent from my iPhone using Tapatalk

Re: Recovery after power failure

PostPosted: Wed Feb 17, 2021 1:40 pm
by kw123
... and it is a problem that needs a solution. Even if it happens once every 100 years. We can’t just give up. I could not sleep without trying to solve it.


Sent from my iPhone using Tapatalk

Re: Recovery after power failure

PostPosted: Wed Feb 17, 2021 2:04 pm
by peszko
My approach was to buy an oversized UPS and a backup generator. I have the whole computer closet (all the networking, cameras and indigo) connected to a server ups that will run all of this for a bit over five hours. Since I'm hardly ever longer than that away from the house, this gives me enough time to spin up the generator (on a manual transfer switch). Id love to have an automatic transfer switch with an auto start generator, but until now the it has been out of my price range.

Re: Recovery after power failure

PostPosted: Wed Feb 17, 2021 2:26 pm
by McJohn
kw123 wrote:
... and it is a problem that needs a solution. Even if it happens once every 100 years. We can’t just give up. I could not sleep without trying to solve it.


That could be my text Karl. I completely agree with you!

So, shall I contact the Italian? :wink:
An extension of the Arduino Plugin? :D
Or maybe a redirect from the Mac mini power switch (inside) to a relais or so to the GPIO port of an Rpi?