Life360 home/away Automation

I’d like to use Life360 to turn on a light when I arrive home. I have it configured, but I’m at a loss to know what syntax to use to create an automation. I’m really new at HA and have just basic time of day switches configured (so far).

Do you have written any config so far for the automation?, if yes just share it. Use the </> for the correct formatting of the code here on the forum

You could use something like below.

- id: '1563879765987'
  alias: Home Light on
  trigger:
    platform: state
    entity_id: <Your entity ID>
    from: 'home'
    to: 'not_home'
  condition: []
  action:
  - service: light.turn_on
    entity_id: <Your entity ID>

Thanks for taking the time to reply. I guess I have nothing to share because I can’t create a config. I don’t understand how to use the state with Life360. For my Life360 ID (displayed at the top of HA along my home/away/zone status) it doesn’t have an entity_id when I click on “me”, so how can I define that in the trigger?

Conditions and actions are no problem, I’ve got that down.

EDIT: maybe I got a little closer, still have to test. Does this make sense?

- id: '1567448037661'
  alias: Steve Arrives Home
  trigger:
  - entity_id: device_tracker.life360_steve_major
    from: away
    platform: state
    to: home
  condition: []
  action:
  - data:
      entity_id: switch.82707084dc4f22908b45_1
    service: light.turn_on

Please look at my code above. Because at the trigger you’re using the wrong strings. I.e. ‘home’ and not_home should be used.

And you’re using light turn on on a switch? If you want to use a switch. The correct statement should be switch.turn_on

Sorry but I am on my phone so i can’t upload your code properly

Thanks. I was looking at the way Life360 was displaying at the top of HA, it shows Home, Work, or away (the first two being zones I created) so I figured the state would change from “away” to “home” since when not in any zone, Life360 just displays “away.” I’ll try not_home.

Thanks for the catch on the switch vs light.

You can always see how your device tracker behaves. Check your logs when you leave the house

I know my life360 acts as ‘not_home’. But I’m using my router as presence detection. But I’m using my life360 as location tracking in zones and other addresses.

The sky ain’t the limit with HA

Haha, thanks, I know I’ve not even scratched the surface. I wanted to use my Asus router for presence detection too, but for some reason (like others reported) it is only sending state changes for my wired LAN. I have another thread here on that.

Everything takes time. It took me at least two years from the start and where I’m now. And I’m not even there yet :sweat_smile:

FWIW, you probably don’t want to specify from: not_home, you should just specify to: home. E.g.:

  trigger:
  - entity_id: device_tracker.life360_steve_major
    platform: state
    to: home

Although it’s not likely, it is possible for a device_tracker entity’s state to change directly from a zone to home. By just specifying to: home it will trigger regardless of what the previous state was.

Thanks, that’s a good idea.