Zone + Device Tracker, listen for entering or leaving

Hi Guys,

Could you please help me to figure out how to listen for these events

Thanks you in advance!

You can do something like:

- alias: 'what evah'
  trigger:
    platform: zone
    entity_id: device_tracker.stalker
    zone: zone.stalkerplace
    event: leave
1 Like

Thanks!

But I was expecting something with Appdaemon involved. I’m trying to avoid any internal automation.

If the event is leave as @sj3fk3 said, then you would want this to start

  def initialize(self):
    self.listen_event(self.leave, "leave")

  def leave(self, event_name, data, kwargs):
        self.log(event_name)
        self.log(data)
        self.log(kwargs)

Then pick out the data you want to make the callback more specific.

1 Like

Also check the Appdaemon documentantion: http://appdaemon.readthedocs.io/en/latest/APIREFERENCE.html#get-tracker-state

Sadly, but it doesn’t provide more than “home/not_home” states

Do you have zones set up? I get more than home/not_home…

Yes, I’ve done it.

Could you please share you code?!