peszko wrote:I too have problems with mac mini sleep. I used to get those system sleep events as well, until I disconnected my ups USB cable. Mac mini still insists on sleeping regardless of power settings, so I have to use amphetamine, which works until it crashes (rarely but does) then mini goes to sleep. I'd love a function in Indigo that would prevent computer from sleeping just like amphetamine does. For home automation there is absolutely no reason for the computer to sleep.
Thanks for the extra info about amphetamine crashing. I tried installing
KeepingYouAwake. This is a small wrapper app around the Apple's caffeinate command line utility. You don't actually need this app to run the caffeinate command but this makes it easier as it can start automatically. The way the caffeinate command works is that you can use the -w parameter to pass a PID for it to disable sleep while this process is running. Running KeepingYouAwake I saw these processes:
- Code: Select all
501 80493 1 0 6:05pm ?? 0:01.39 /Applications/KeepingYouAwake.app/Contents/MacOS/KeepingYouAwake -psn_0_1864135
501 80580 80493 0 6:06pm ?? 0:00.01 /usr/bin/caffeinate -di -w 80493
So basically KeepingYouAwake starts, gets its own PID and calls caffeinate to wait for itself to finish. Running pmset -g confirms that both caffeinate and Amphetamine have a sleep assertion active:
- Code: Select all
sleep 0 (sleep prevented by caffeinate, Amphetamine)
displaysleep 180 (display sleep prevented by prl_client_app, caffeinate, Google Chrome)
This would be the perfect solution if it wasn't by the -di parameter: -i prevents idle sleeping but -d prevents display sleeping, which I don't want to prevent. Note this doesn't prevents the displays from going to sleep, it just prevents the displays from idle sleep, so you can still have displays going to sleep if you trigger this from the OS. So I might get the code from GitHub and change it myself to remove the -d option. Or perhaps just do an Indigo plugin that finds out the Indigo Server PID and calls caffeinate with the parameter only (ie "caffeinate -i -w [PID]"). That would be kicked when Indigo starts and it will be more clean than having a separate App.
Can an Indigo Plugin execute an OS command like caffeinate?
PS: There is also an App called
Taurine which does the same thing although it hasn't been updated in a while. So in theory you could have Amphetamine, caffeinate and Taurine all running at the same time!