Life360 Device Tracker Platform

Did you restart HA from the command line (or however you need to) as opposed to restarting from the frontend?

Also, by “/config/custom_components/…” do you mean something like “/home/homeassistant/.homeassistant/custom_components/…”? You can see where your “config” folder is by going to the Info page in the frontend. You should see a line like this:

Path to configuration.yaml: /home/homeassistant/.homeassistant

That is your “config” folder.

ugh. It was me being dumb. Sorry.
I was just reboot from the front end. Not restarting the docker container.

Working now. thank you!

1 Like

What I’m trying to achieve is to update the device tracker entity with, Home, Away, Driving.
image

I just don’t know how to create a template that the device_tracker component will use.
I can easily use a template that will send text notifications of status to include driving, I just want to have it update the device tracker entity as well.

I think it’s the other way around. I.e., you could create a template sensor that uses info from the device_tracker entity.

I think I have that down.
It’s just not showing the state in the image. If you click on the sensor, it shows the state.
Just not sure how to make it show the label.

image
device_tracker on left, template sensor on right.

So I’m just guessing here, but can you set the “unit of measure” attribute with the value you want to see there? (Responding on phone so can’t really try it right now.)

Yep!
That’ll work.
Just need to figure out how to pull the state!

Thanks!

I think I may have figured it out.
No need to use a custom sensor. You can use device_tracker.see to update the device trackers location_name.

So I have an automation to update the location of my device tracker when the attribute driving is true.

Just need to test it.

- alias: Location - Set William Driving

  trigger:
    - platform: template
      value_template: "{{is_state_attr('device_tracker.xxxxx', 'in_transit', true)}}"

  action:
    - service: device_tracker.see
      data:
        dev_id: xxxxx
        location_name: 'Driving'

Then I have another automation that fires when driving is set to false the changes the location_name to ‘not_home’

I’m sure I could combine the two automatons somehow but I’m not that advanced. haha.

So it seems that the ‘driving’ attribute isn’t quite working.

Life360 is in driving mode but Hass isn’t pulling the attribute.

The ‘in_transit’ attribute works though!

I’ve also noticed that ‘wifi connected’ is constantly true.

Having issues automating with these attributes but I’m sure its my automations. I’ll keep testing.

I noticed the same thing. But I’ve verified with Postman - that’s what the server is sending. Maybe you have to sign up for their drive detection feature for the driving data to be valid???

I did verify that the WiFi status will change. Remember there is potentially up to 30 min or more of delay sometimes before their server is updated.

Perhaps, yeah.
The in_transit attribute should be enough to facilitate driving.

Who knows. It could be reporting if the phone’s WiFi is on, not whether or not it’s actually connected to a WiFi network. When I tested that part I actually turned my phone’s WiFi off and it did eventually show that. Right now my wife happens to be driving in the corn fields and I know she’s not getting any WiFi service, yet it still shows true.

I think I’ll change that attribute from “wifi_connected” to “wifi_on”, since that seems to be what it means.

Yep. just confirmed that it is definitely relating to whether wifi is turned on or not and not it’s connection state.
got my automations working too. So now my device tracker entity displays when I’m in transit. :slight_smile:

1 Like

If it’s not too extensive could you share some of the specifics of what you came up with?

for my automation to update the device tracker location to driving?

Yes. And did you do something to show that as a sensor label like we were discussing before?

yeah so I just used the standard device_tracker.xxxx item and used the device_tracker.see platform to manually update the location name.

Here’s my automation for updating the device trackers location based on the ‘in_transit’ state attribute.

- alias: Location - Set xxxx Driving

  trigger:
    - platform: template
      value_template: "{{is_state_attr('device_tracker.xxxx', 'in_transit', true)}}"

  action:
    - service: device_tracker.see
      data:
        dev_id: xxxx
        location_name: 'Driving'

In the action, the dev_id is the device trackers name. For example, say my device tracker item is device_tracker.joe_ the value for dev_id would be ‘joe_’ (minus the quotes).

The location_name: item is what you would like the ‘label’ on the Device tracker entity to be.

1 Like

As I think about this some more, although this does seem to satisfy the desire to have the appearance in the frontend as you want it, it will be causing extra events and processing. E.g., although I haven’t verified this, I would think when the platform updates the entity, that will of course cause an event, which will run the automation. The automation will update the entity’s state, which will cause another event, which will cause the automation to run again. Of course, this time, even though it will invoke the device_tracker.see service, the entity won’t actually change, so there shouldn’t be another event. Then things will settle down until the next platform update. (Which, BTW, will probably be every 45 seconds or so, since you’re “in transit”.) So each time instead of just one event, there will be two events and two automation runs. Not terrible, but just be aware.

What might be less than desirable, though, is the state constantly changing to ‘not_home’ (aka ‘away’) and then right back to ‘driving’. At least, that’s what I think might happen.

You might want to watch the log to see if this really is happening. If so, you might be better off customizing the platform than doing this with an automation. It should be fairly easy. E.g., add something like this right before the call to self._see():

if not loc_name and attrs[ATTR_IN_TRANSIT]:
    loc_name = 'driving'

Just a thought.