Indigo Server not responding

Posted on
Tue Jun 11, 2019 11:44 pm
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

Indigo Server not responding

So I woke up this morning and Indigo was not responding this morning. I knew this as triggers didn't fire for lights as I woke around the house. Having said that Indigo was up and running on my Mac. I checked the log events and I found the source of the problem at 1:46am:

2019-06-12 01:46:46.064 Application Received sleep notification from system

After that event all the following log events are mostly plugin error events (UniFIAP, RFXCOM, etc) or triggers triggered by plugins. Obviously it seems Indigo received a sleep notification and shutdown but why? My Mac never sleeps and I have the option "Prevent computer from sleeping automatically when the display is off" in Energy Saver settings. The Mac has been running fine for weeks and I haven't upgraded or changed any MacOS configuration recently (I am on MacOS Mojave 10.14.5). Any ideas?

Posted on
Wed Jun 12, 2019 12:22 am
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

Re: Indigo Server not responding

Ummm that’s not very reassuring. Maybe a Indigo could have an option to ignore OS sleep requests? It would make a lot of sense since most people would want to run Indigo 7x24. In fact there are known cases when some Apps block the OS from going to sleep and posts on the web suggest running “pmset -g assertions” to see what app is blocking the OS from sleeping. Is there something that I can do on MacOS to prevent the OS from sleeping?

Posted on
Wed Jun 12, 2019 9:45 am
peszko offline
Posts: 311
Joined: Mar 07, 2012

Re: Indigo Server not responding

I'm not sure if its not OS that is sending an unwanted sleep signal to applications including Indigo. What I had with my system that is running on a UPS is that when power was cut, Indigo got the exactly the same error and started shutting down. This is not what I want. I wanted the system to start shutting down with 10 minutes or so power left, not the second the power is lost (the UPS can run the whole setup including routers and cameras (POE) for about 6 hours). And Yes, id did have the settings set to shut down when ups has 5% power left. I had some other issues with the ups integration so for now i have disconnected the USB cable from ups, and it seems to have solved three problems.

    Immediate sleep on power loss to ups
    Systems insitance on sleeping regardless of settings
    Time machine not backing up as it considered being on battery power

It seems to me as the OS is really aggressive with power usage if it thinks the system is on batteries regardless if its plugged in. Also, myUPS may be providing wrong data to the OS.

Posted on
Wed Jun 12, 2019 2:59 pm
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

Re: Indigo Server not responding

I do have an APC UPS connected via USB but I doubt that was the issue. If the UPS went on battery I would have listened to it since it would have beeped. And I have already tested several times my Mac won't shutdown when the power is cut, since the UPS has plenty of battery to run for 30mins or so. I look around and I couldn't find any log files where the UPS data is shown. I did find several interesting events though:

System.log
Code: Select all
Jun 12 01:46:46 MyMacMini-2 cthelper[69]: [main] Received SIGTERM...
Jun 12 01:46:46 MyMacMini-2 fud[81608]: objc[81608]: Class MobileAssetUpdater is implemented in both /System/Library/PrivateFrameworks/MobileAccessoryUpdater.framework/Support/fud (0x10c676ff0) and /System/Library/AccessoryUpdaterBundles/ApplePowerAccessoryUpdater.bundle/Contents/MacOS/ApplePowerAccessoryUpdater (0x10f9f5a68). One of the two will be used. Which one is undefined.


parallels.log
Code: Select all
06-12 01:46:46.063 F /disp:18167:83203/ System events monitor: host going to sleep, prepare
06-12 01:46:46.064 F /disp:18167:83203/ System events monitor: host going to sleep, done
06-12 01:46:46.076 F /disp:18167:83203/ System events monitor: host was wakeup, prepare
06-12 01:46:46.076 F /disp:18167:83203/ System events monitor: host was wakeup, done


pmset -g log
Code: Select all
2019-06-12 01:46:46 +0100 Assertions             PID 61(powerd) Created InternalPreventSleep "com.apple.powermanagement.darkwakelinger" 00:00:00  id:0x0xd0000a6a5 [System: PrevDisp SRPrevSleep kCPU kDisp]
2019-06-12 01:46:46 +0100 Assertions             PID 188(coreaudiod) Released PreventUserIdleDisplaySleep "com.apple.audio.context259.preventuseridledisplaysleep" 03:53:09  id:0x0x50000a266 [System: PrevDisp SRPrevSleep IPushSrvc kCPU kDisp]


Here is a good page explaining all the options of the pmset command. If you want to see live data from your UPS run "pmset -g pslog". Sample output:

Code: Select all
2019-06-12 21:56:09 +0100 com.apple.system.powersources
2019-06-12 21:56:10 +0100 com.apple.system.powersources.timeremaining
2019-06-12 21:56:10 +0100 IOPSNotificationCreateRunLoopSource
 -Back-UPS XS 1400U  FW:926.T2 .I USB FW:T2  (id=10485760)   100%; charging present: true


I have also installed the UPS and Battery Monitor plugin from the Plugin Store so I can now monitor the UPS data on my Indigo logs. Create a trigger on the UPS device and use this Python code to log a message to the Indigo Log:

Code: Select all
import datetime

def log(msg):
   indigo.server.log(msg, type="UPS Updated Trigger")

device1 = indigo.devices[1940212093] # "UPS APC XS 1400U"
deviceACPower = str(device1.states["ACPower"])
deviceBatteryLevel = str(device1.states["BatteryLevel"])
deviceBatteryTimeRemaining = str(device1.states["BatteryTimeRemaining"])
deviceCharging = str(device1.states["Charging"])
devicePowerSource = str(device1.states["PowerSource"])
deviceLastChangedDT = device1.lastChanged.strftime("%-d-%B-%Y %-H:%M.%S")

log(deviceLastChangedDT + " / Battery Level: " + deviceBatteryLevel + " / AC Power: " + deviceACPower + " / Battery Time Remaining: " + deviceBatteryTimeRemaining + " / Charging: " + deviceCharging + " / Power Source: " + devicePowerSource)

Posted on
Sat Jul 13, 2019 6:03 am
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

Re: Indigo Server not responding

This happened again last night, I am not happy:

Code: Select all
2019-07-13 03:26:50.909   Application   Received sleep notification from system


As I am now logging UPS events and UPS state every 10 seconds I can confirm the sleep request was not triggered by the UPS. While this seems like a bug in Mojave I would argue it should be handled better in Indigo. For start I can't think of why someone would want to run a home automation system that shuts down when the computer goes to sleep. Indigo should have a built-in option which should prevent it from going to sleep and that option should be set by default. Furthermore Indigo is inconsistent on how it reacts to the sleep event. While the main server process seems to go to "sleep" plugins continue to work and log events. Indigo Touch responds but can't do much. So at best we could say Indigo is "half asleep". In fact today I unlocked my Mac and noticed Indigo "woke" itself up:

Code: Select all
2019-07-13 09:27:10.119   Application   Received awake notification from system


After which Z-Wave started to work again and everything was fine. So clearly Indigo is able to handle these OS events so should be able to have an option to not go to sleep.

I Google'd around and found this neat little free app called Amphetamine (great name BTW!). This should prevent my system from sleeping so hopefully it will enough workaround the incorrect Mojave behaviour. I will report back if I see the issue again otherwise assume Amphetamine is working fine for me.

Posted on
Sat Jul 13, 2019 9:03 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Indigo Server not responding

Indigo has to catch the masOS sleep notification event (which is what is causing this – it is definitely coming from the OS) so that it can upload logic/schedules to some interfaces that support Mac-less operation (1132CU and 2414U), and then disconnect from the interfaces so they can run independently. In theory we might be able to skip that logic for other interfaces (2413U, CM11, etc.), so I'll add that to the feature request list to investigate further.

Image

Posted on
Sat Jul 13, 2019 10:37 am
peszko offline
Posts: 311
Joined: Mar 07, 2012

Re: Indigo Server not responding

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.

Posted on
Sat Jul 13, 2019 11:31 am
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

Re: Indigo Server not responding

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! :mrgreen:

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 9 guests