So I do something like that. What I do is this:
- When I’m traveling (more on this in a second) turn on high accuracy mode. Turn off when done
- When high accuracy mode isn’t on I request a location update every 30 minutes.
For #2 I actually don’t caveat this to “not home”. I used to say “only when not in a zone” but then once in a while I would get stuck. My phone wouldn’t realize it had left the location ever until I forced an update. Once every 30 minutes seemed like a reasonable compromise for battery life and never getting stuck.
For #1, “traveling” took me quite a while to get right. But I don’t just use it for high accuracy mode, I also use it for ETA tracking and not just with cars (sometimes I bike, take transit or walk). Here’s a kind of overview of what I do, feel free to use what makes sense for you. I am traveling if:
- State of the
device_tracker
isnot_home
- I am not on any wifi (for me, this means I am at a fixed location like 99% of the time)
- The detected activity from my phone is not
walking
orstationary
(exception: my expected travel mode iswalking
, thenwalking
counts) - If the detected activity from my phone is
unknown
, then is myspeed
greater then 1.5 m/s (0.5 m/s ifwalking
is my expected travel mode). FYIspeed
is an attribute of thedevice_tracker
, its not a separate sensor.
The last one is kind of a bummer. I would much prefer to just rely on detected activity since I found its pretty accurate in any state besides unknown
. But the problem is anytime it’s unsure what your travel mode is it goes to unknown
(which happens a bunch) and unknown
is utterly useless. It’s got hard-coded confidence levels and tells you nothing. There’s no way to tell if you’re between biking and driving, stationary and walking or anything else. It hides all that data from you for some reason.
dshokouhi and I tried to report an issue to google about it but didn’t really get traction. So falling back on speed
was the best option I could think of.
One other thing, traveling is a template sensor in my config and it has delay_off: 00:02:00
. So once those conditions are met it won’t go off unless they aren’t met for at least 2 minutes. This keeps it from flipping off everytime I hit a traffic light.