I created a trigger to tell me if the iPhone is close to home
- Code: Select all
set distance to DistanceAway of device "iPhone"
if distance < 2.0 then
set value of variable "isHouseOccupied" to "true"
set value of variable "isRyansPhoneHome" to "true"
log "Ryan's iPhone was found closer than 2 miles away... it's home"
return true
else if distance > 2.0 then
set value of variable "isHouseOccupied" to "false"
set value of variable "isRyansPhoneHome" to "false"
log "Ryan's iPhone was found more than 2 miles away... it's not home"
return false
else
log "distance variable is blank"
set value of variable "isHouseOccupied" to "false"
set value of variable "isRyansPhoneHome" to "false"
end if
This code throws an error in the log:
- Code: Select all
Error script error: around characters 891 to 903
Error script error: IndigoServer got an error: Can’t get DistanceAway of device "iPhone". (-1728)