I've set up some basic triggers in Indigo to monitor our washer & dryer in our basement using iMeters. In a nutshell when the power consumption goes above a certain level Indigo knows they're running, and when they stop running it sends a page to me & my wife to let us know a wash/dry cycle is complete. It's extremely helpful in reminding us to check on the laundry.
I'd now like to modify this a bit to make its paging of us a bit smarter. I've installed the Smartphone Radar plugin and would like to integrate both it and some timing rules into how we get paged. In a nutshell I'd like it to only page us if either of us is home, and if neither is home then wait until one or both are home. And if it's after say midnight then don't bother paging us at all (or perhaps wait until the next morning to page us). So in pseudo-code I'm thinking of something along these lines:
- Code: Select all
while !paged ; do
if (after midnight) ; then
paged = true;
endif
if (bruce or heather is home) ; then
page whoever is home;
paged = true;
endif;
sleep 15 minutes if !paged;
done
So the big question I have is whether a loop like this is kosher in a script used in a condition or not. I can see where the loop could remain active for a few hours waiting for one of us to show up to get paged. Would that potentially get Indigo into any sort of bad state? Also does it make sense to have an action within part of the condition like this? I assume I'd just set the action in the dialog to "None" in that case. Any comments, suggestions, etc. would be greatly appreciated.
-Bruce