Got it. For those looking for this:
- Code: Select all
set distanceAwayAS to 1
set awayDepartTimeAS to 1
set currentIndigoHourAS to 1
set aVGSpeedAS to 1
set AwayReturnTime to 1
set ChecktimeAway to 1
tell application "IndigoServer"
set distanceAwayAS to (value of variable "DistanceAway") as number
set awayDepartTimeAS to (value of variable "AwayDepartTime" as number)
set currentIndigoHourAS to (value of variable "CurrentHour") as number
set aVGSpeedAS to (value of variable "AVGSpeed") as number
end tell
set hoursAwayAS to distanceAwayAS / aVGSpeedAS
set AwayReturnTime to awayDepartTimeAS + hoursAwayAS
set ChecktimeAway to AwayReturnTime - 2.5
if ChecktimeAway < currentIndigoHourAS then
tell application "IndigoServer"
set (value of variable "AwayStartup") to true
end tell
end if
Thank you Jay and Matt! I really appreciate the help! Offering your time, regardless of how much on a Saturday afternoon during NFL wildcard weekend is above and beyond the call of duty
For those curious, when my house goes into away mode, I have the google voice plugin text me each morning and ask me if I plan to return that day. If I respond yes, I get prompted for an estimated time of departure. This enables or disables a few triggers and schedules.
Once it receives that, it passes it to an indigo variable. I have another indigo variable populated with the find my idevice plugin distance away. I'm doing a rough estimate of travel time by the crow flies of that distance divided by my average speed... say 65.
Once it knows I am about two hours out from the house, based on my earlier response and a check to see that I am indeed coming home (a little bit earlier and later than my estimated time of departure), it readies the house for my arrival. Turns on some lights right before I get there, gets the heat bumped up to a comfortable temperature.
The easy way to do this would be to fire off the FMID plugin all the time when I am away, or even just for the day, but I tend to get on the low side of battery life, especially when traveling, so this pings my device the minimum number of times with still reliably getting everything fired up at the optimal time.
My wife asked me tonight why she can't just turn on the heat on our way home... my response, because I'm lazy and don't want to think... which is what home automation is all about