What event I should listen to when user arrives or leaves a zone?

I’m using iOS app to track if user arrived or left zones. I’d like to use AppDaemon to send me iOS push notification when someone in my family arrives or leaves a zone.

I currently have this in my app but I guess the vent name I have “arrive” or “leave” is incorrect as I was never able to trigger this event.

  self.listen_event(self.arrive_event_handler, "arrive", zone = zone)
  self.listen_event(self.leave_event_handler, "leave", zone = zone)

Can someone tell me what event I should listen to when user arrives or leaves a zone?

Thanks,
Joe

i think you need

listen_state(self.arrive_event_handler, “device_tracker.your_device”)

and then in the handler

if new = “which_zone_description_the_tracker_has”:
do some stuff

1 Like

I was looking at this thread: Zone as trigger with the new iOS tracker

and thought I’d need some like this but implemented in AppDaemon way:

trigger:
- platform: zone
  entity_id: device_tracker.iphone_7_plus
  zone: zone.Sjofartsverket
  event: leave
action:...

I’ll give what you suggested a try, thanks!

1 Like

Note:
I tried to catch the events and there is no event from zone / device tracker like “leave” etc. (I tried google maps shared location)
AppDaemon Version 3.0.1

Captured by listen_state
entity=‘device_tracker.google_maps_12345678’
attr=‘state’
old=‘home’
new=‘home’
kwargs={‘handle’: UUID(‘12345-xxxx-xxx…xxx’)}

Or:

Captured by listen_event
event=‘device_tracker_new_device’
data{‘entity_id’: ‘device_tracker.ipaq’, ‘host_name’: ‘ipaq’, ‘mac’: ‘00:12:34:56:78:9A’}
data{‘domain’: ‘device_tracker’, ‘service’: ‘see’, ‘service_data’: {‘mac’: ‘00:12:34:56:78:9a’, ‘host_name’: ‘ipaq’, ‘consider_home’: ‘06:00’, ‘source_type’: ‘router’},
"