Looking for some help creating an automation using the life 360 integration.
I want to use the state attribute “address” so that when it changes to “Home” it triggers a call service.
I have got a working call service job set up from another simple automation so I’m okay with that but I don’t understand the syntax required for querying the state attributes for an entity?
alias: Dan Home
description: ''
trigger:
- entity_id: device_tracker.life360_daniel_kitchen
platform: state
to: home
condition: []
action:
- data:
data:
icon: /config/images/dan.png
message: Dan has arrived Home
service: notify.tv
But this using the default state “home” which is just too slow at updating to HA, I’m in the house before the automation has even triggered. If I can query the state attribute for “address” this will be instant when I enter the geo location.
you will see that the default interval, for server query, is 12 seconds.
You can adjust as required.
A major point to note is this is an ‘unofficial’ api route.
And if you set it to something stupid like 2 seconds then the server will be pinging constantly, enough people do that and they close the back door, so please don’t.
Instead you can increase the radious of your ‘home’ Life 360 default (and minimum) is 250 feet (76m)
AND you should always match your HA home radius to your Life 360 radius.
So if you frequently walk home 76m is often enough. If you drive home then you might want to increase the radius to (say) 250m or even 400m (suck it and see) this will give the app enough time to trigger to fire your automations.
Your automation looks correct, you can’t query the state attribute (it just gets updated when it has something to say).
You ‘can’ get attributes from the device tracker like so : -
“{{ ‘%.3f’ | format(distance(states.device_tracker.life360_bob)) }}”
And then you can set an individual distance threshold to fire a) lights b) heating c) notifications if that’s your preferred route
It formats the output to 3 dp so 76.3452762 becomes 76.345 or 76km and 345m it’s just easier to relate to it that way and it looks more consistant when displayed