Automation for home or away, can't figure out

Newbie here, I am having a hard time figuring out the simple trigger of if I am away or home. Should I be using Zone (leave, entry) with device trigger or person or is it better to use device/person tracker entity state? are there any delays in updates to these triggers. the reason I ask is that I am getting inconsistent results. For example, using zone it works when I enter the home, but does not work when I am away. The state of person shows the correct update but does not trigger automation.

And when I check for the state such as Away and Home, does it matter if the first letter is capital or not? Cap sensitive? What does the system use as a state? Because if I look at the the state variable is seems to be set to “away” but on Lovelace it shows as “Away”

If I use the developer to change the state, how quickly will it revert back to true status based on my iPhone location?

Sorry about the long list of questions but any guidance would be appreciated…

Always use the one displayed in the State column of Developer Tools > States (so for your example it’s away not Away).

thank you for the clarification as a learn about the correct syntax of YAML.

Any insight on differences using
zone.home
person.joe
device_tracker.joe_iphone

and difference between call service?
notify.notify (broadcast notification to all devices?)
notify.mobile_app_joe_iphone (specific to only iPhone device)

thanks

I can’t provide more insight into the differences between zone/person/device_tracker beyond what is already mentioned in the documentation (I don’t personally use any of them). Nor do I use notifications to a mobile app so I can’t comment on that. Hopefully someone else will join the discussion and help you with those two topics.

Here is code that I use to lock our Sunroom when we are both away.

- id: '1609025102736'
  alias: Lock Sunroom
  description: Lock Sunroom when both of us are gone
  trigger:
  - platform: device
    device_id: b28c0c74e73e12b300195f156587d607
    domain: device_tracker
    entity_id: device_tracker.jeffs_iphone
    type: leaves
    zone: zone.home
  - platform: device
    device_id: 2740d2e3d5d1b2c3a4f75aefcdebf643
    domain: device_tracker
    entity_id: device_tracker.angies_iphone
    type: leaves
    zone: zone.home
  condition:
  - condition: and
    conditions:
    - condition: device
      device_id: b28c0c74e73e12b300195f156587d607
      domain: device_tracker
      entity_id: device_tracker.jeffs_iphone
      type: is_not_home
  - condition: device
    device_id: 2740d2e3d5d1b2c3a4f75aefcdebf643
    domain: device_tracker
    entity_id: device_tracker.angies_iphone
    type: is_not_home
  action:
  - service: lock.lock
    data: {}
    target:
      entity_id: lock.sunroom_deadbolt_6
  mode: single