Device_tracker automation

I am trying to get some device_tracker automation going, and started with a notification when I leave work to test it out. But it does not send anything when I leave. I am using OwnTracks and that is working fine. My “JasonsPhone” icon shows on HA, and it shows when I am “home” or at “work”. Any idea what the problem is?

Here is my automation

  - alias: "LeftWork"
    trigger:
      platform: zone
      entity_id: device_tracker.JasonsPhone
      zone: zone.work
      event: leave
    action:
      - service: notify.pushbullet
        data:
          title: "You left work"
          message: "You left work"

Here is my zone (X’ed out for privacy)

zone:
  name: work
  latitude: XX.862362
  longitude: -XX.158890
  radius: 250
  icon: mdi:domain

What if you tried this instead?

  - alias: "LeftWork"
    trigger:
      platform: state
      entity_id: device_tracker.JasonsPhone
      from: 'work'
    action:
      - service: notify.pushbullet
        data:
          title: "You left work"
          message: "You left work"
1 Like

that did not work, just went quite a distance from work. and no. notification.

That’s odd. I wonder if there are automation bugs, I’ve also experienced a few that used to work and don’t now.

do you have remote access to HA? if so, you want to pull up a browser and confirm that you device_tracker state starts as ‘work’ and changes to something else.
You can watch the state change in the developer tool.

Yes I do, and I could see that it said “AWAY” when I was at lunch and now it says “WORK”. And my pushbullet notifications are 100% working. I got others today from HA.

What is the developer tool? I do not see that.

My logbooks shows…
12:42 PM
JasonsPhone is at work

I can confirm mine also says “Work”. I believe it’s case sensitive so you’d have to confirm with the zone names you gave it.

Yes, be absolutely certain you have the case exactly the same as it is in your zone.
so if you are right and it says your location is WORK then you need to change your automation to:

  - alias: "LeftWork"
    trigger:
      platform: state
      entity_id: device_tracker.JasonsPhone
      from: 'WORK'
    action:
      - service: notify.pushbullet
        data:
          title: "You left work"
          message: "You left work"

Looks like I got this working (hard to troubleshoot) it was the device_tracker name, its a name with a long list of numbers after it. Thought it was just “JasonsPhone” because that was the name, but its the title at the top of the known_devices.yaml file. Thanks all for the help!

Here is a link to the developer tools documentation. Take a look. It will save you tons of heartache like this in the future.