Automation rule iphone Entity device_tracker.iphone - Away

After installing home assistant app on an iPhone, I want to create an automation based on the state of this entity ‘device_tracker.iphone’. I see when looking at the entity value it shows ‘Away’ when the phone is not in use.

However when trying to set up an automation rule for when the iPhone is “away” using ‘and if’ the state equals attribute value of ‘Away’, it only shows GPS values for that entity type.

How can I use an automation rule with a condition that’s based on this entity status of "Away’?

Can you show us your code? My device tracker (Android) shows “home” and “away” - the gps values are attributes.

Yes, same for me on my Android and iPhone devices. But how do I use either of those values as automation conditions?
When I’m in automation condition fields, I don’t see how you set it to ‘away’ or ‘home’

description: "If kitchen lights come on when I'm not home, sound the alarm"
mode: single
triggers:
  - trigger: state
    entity_id:
      - light.kitchen_counter_lights
    to: "on"
conditions:
  - condition: state
    entity_id: device_tracker.nokia_g21
    state: not_home
actions:
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.kitchen_siren_switch

Or is this not what you mean…?

1 Like

Thank you for helping me. So I’m a little confused, does this entity correlate to my zones and if so, how does it determine the ‘away’ value versus other establishes zone values?
If I’m off on this, essentially I want to have an automation that triggers when this particular entity equals the value ‘away’

Have a look here:

…and here:

An automation that triggers when your phone leaves the home zone could start with something like…

triggers:
  - trigger: zone
    entity_id: device_tracker.nokia_g21
    zone: zone.home
    event: leave

If you’re using the GUI the trigger type would be “Time and Location”.

Alternatively, you could use an entity state:

triggers:
  - trigger: state
    entity_id:
      - device_tracker.nokia_g21
    to: not_home

Both of these use the home zone. There are several ways to do most things. :grinning:

1 Like