iCloud presence based trigger

Hello,

I’m trying to set up a simple automation based on presence but I just can’t figure out what I’m doing wrong since I’m basically using given templates for configuration. Everytime I restart HA with this config it won’t start up. I used 2 ways and both didn’t work. Here are the 2 configs I tried:

# Notification when away
automation:
  - alias: Notification when away
    trigger:
     platform: zone
     entity_id: device_tracker.username
     zone: zone.home
     event: leave
    action:
     service: notify.notify
     data:
      message: Bye

# Notification when away
automation:
  - alias: Notification when away
    trigger:
     platform: state
     entity_id: device_tracker.username
     from: 'home'
     to: ‘not_home’
    action:
     service: notify.notify
     data:
      message: Bye

Does anyone know what I’m doing wrong?
Tracking is working perfectly

Is this your only automation, or are there others? If you have multiple automations, are they in the same yaml file? What error message are you getting on startup of HA?

You may have duplicate automation entries. That should only occur once in your HA environment.

That was it! Thank you so much, I spent soooo much time on this lol.