Recovery after power failure

Posted on
Tue Feb 16, 2021 4:48 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Recovery after power failure

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

Posted on
Tue Feb 16, 2021 8:14 am
Different Computers offline
User avatar
Posts: 2541
Joined: Jan 02, 2016
Location: East Coast

Re: Recovery after power failure

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.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue Feb 16, 2021 8:20 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Recovery after power failure

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

Posted on
Tue Feb 16, 2021 10:53 am
yassi offline
Posts: 468
Joined: Sep 06, 2015
Location: Germany

Re: Recovery after power failure

What about putting a SwitchBot on the power button (if the Mac model allows it) and restart it “manually”?


Gesendet von iPhone mit Tapatalk

Posted on
Tue Feb 16, 2021 4:25 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: Recovery after power failure

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.

Posted on
Tue Feb 16, 2021 4:34 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Recovery after power failure

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

Posted on
Tue Feb 16, 2021 6:11 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: Recovery after power failure

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.

Posted on
Tue Feb 16, 2021 6:16 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Recovery after power failure

it only worked once. the second time i tried it nothing happened.. mac stayed off :(

need to dig deeper

Posted on
Tue Feb 16, 2021 9:40 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Recovery after power failure

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

Posted on
Wed Feb 17, 2021 4:01 am
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: Recovery after power failure

damn.

Posted on
Wed Feb 17, 2021 11:24 am
McJohn offline
User avatar
Posts: 631
Joined: Dec 18, 2012
Location: The Netherlands

Re: Recovery after power failure

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

Posted on
Wed Feb 17, 2021 1:38 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Recovery after power failure

And I really like the Italian.


Sent from my iPhone using Tapatalk

Posted on
Wed Feb 17, 2021 1:40 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Recovery after power failure

... 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

Posted on
Wed Feb 17, 2021 2:04 pm
peszko offline
Posts: 311
Joined: Mar 07, 2012

Re: Recovery after power failure

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.

Posted on
Wed Feb 17, 2021 2:26 pm
McJohn offline
User avatar
Posts: 631
Joined: Dec 18, 2012
Location: The Netherlands

Re: Recovery after power failure

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?

Who is online

Users browsing this forum: No registered users and 3 guests