Location Tracker - not_home vs Away

So I have a couple simple automations such as this one which works just fine

- alias: "Leaving Work"
  trigger:
  - platform: state
    entity_id: device_tracker.me_iphone
    from: 'Work'
  action:
  - service: notify.pushbullet_notifications
    data:
      message: "I have has Left Work"
      target:
      - email/[email protected]
      title: " Location Alert"

I was thinking I’d do something to cover all zones I have set up (I have 4 or 5)

- alias: "Leaving Location"
  trigger:
  - platform: state
    entity_id: device_tracker.me_iphone
    to: 'Away'
  action:
  - service: notify.pushbullet_notifications
    data:
      message: "I have Left {{ trigger.from_state.state }}"
      target:
      - email/[email protected]
      title: "Location Alert"

I believe this will work, but I remember in some of my other automations I had to use “not_home” even though “away” is what you see in the UI. So my question is, is not home always the same as away, or is that just the state that means your previous location was HOME.

So if I leave work is and have not entered a zone is my state “not_home” or away?

I can test this out, but requires me coming and going a few times. :slight_smile: If no one has any input I’ll answer my own question in a day or two after I’vehad some time to verify.

Replying to my own question. I should have looked at my other automations before asking. I had another that I needed not_home to work.

So I’ll post these simple automations if you needed to get alerts when someone arrived or left zones.

- alias: "Leaving Location Alert"
  trigger:
  - platform: state
    entity_id: device_tracker.me_iphone
    to: 'not_home'
  condition:
  - condition: numeric_state
    entity_id: sensor.ha_runtime_in_minutes
    above: 1
  action:
  - service: notify.pushbullet_notifications
    data:
      message: "I left {{ trigger.from_state.state }} at {{ as_timestamp (now()) | timestamp_custom('%I:%M %p') }}"
      target:
      - email/[email protected]
      title: "Location Alert"

- alias: "Arriving at Location Alert"
  trigger:
  - platform: state
    entity_id: device_tracker.me_iphone
    from: 'not_home'
  condition:
  - condition: numeric_state
    entity_id: sensor.ha_runtime_in_minutes
    above: 1
  action:
  - service: notify.pushbullet_notifications
    data:
      message: "I arrived at {{ states('device_tracker.me_iphone') }} at {{ as_timestamp (now()) | timestamp_custom('%I:%M %p') }}"
      target:
      - email/[email protected]
      title: "Location Alert"
1 Like

not-home is true when you are not at home AND not in a preset location.
If you have 2 locations overlapping each other, you will not go from [say] zone 1 to not_home to zone 2, so bear this in mind.
For the actual checking if I’m home or not, I instead use {% if states.[device tracker entity name goes here].state != "home" %}

1 Like