Notify Entering Zone

This is very similar to the official notify_leaving_zone but for entering zones. I just switched != and == around.

Edit: I made this because I already have zone entering notifications, so I had no use for the official leave zone notification. But after some testing it seems like the official one doesn’t work for me, and neither does this one.

Get started

Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Zone Entering Notification
  description: Send a notification to a device when a person enters a specific zone.
  domain: automation
  input:
    person_entity:
      name: Person
      selector:
        entity:
          domain: person
    zone_entity:
      name: Zone
      selector:
        entity:
          domain: zone
    notify_device:
      name: Device to notify
      description: Device needs to run the official Home Assistant app to receive notifications.
      selector:
        device:
          integration: mobile_app

trigger:
  platform: state
  entity_id: !input person_entity

variables:
  zone_entity: !input zone_entity
  # This is the state of the person when it's in this zone.
  zone_state: "{{ states[zone_entity].name }}"
  person_entity: !input person_entity
  person_name: "{{ states[person_entity].name }}"

condition:
  condition: template
  value_template: "{{ trigger.from_state.state != zone_state and trigger.to_state.state == zone_state }}"

action:
  domain: mobile_app
  type: notify
  device_id: !input notify_device
  message: "{{ person_name }} has entered {{ zone_state }}"
2 Likes

Is that a typo or are you saying the example you posted doesn’t work?

1 Like

No, probably the device that’s being used for testing doesn’t work.

Yes, I assumed the official one worked, but it does not for me. I tested it by spoofing my location with an app, I saw my location change on the home assistant map but I did not get a notification. When I manually execute both automations, the notification does work.

So this is the official zone blueprint example, with one tiny modification, that failed its tests.

Are you posting it here to help get it fixed?

So this is the official zone blueprint example, with one tiny modification, that failed its tests.

Yes, I figured it may be usefull for someone even less savvy than me. I assumed the official version worked, so figured that the small change shouldn’t effect break it.

Are you posting it here to help get it fixed?

No, I actually noticed it doesn’t work after I posted it (sorry about posting before testing :slightly_frowning_face:). Now I don’t know if the official one is broken in general or just broken on my end. If it is just broken on my end the zone_entering part should work for other people still.

I’m interested on this blueprint, looks like official leaving zone works for me, I will try your “entering zone” and provide feedback.

Yesterday I created 3 zones and 6 automations to notify when entering and leaving zones but didn’t received notifications.
I revised zones and I’ve seen zones are " Passive", I disabled option and today I received notifications for all, entering and leaving but only after I unlocked my phone, home assistant app was “sleeping” even if I disabled battery optimisation, maybe it’s possible to add some priority to blueprint?

So, it’s working, you can upload blueprint to github, thank you!

Thank you for confirming! I guess I have a different issue with the notifications then, at least this blueprint works :slight_smile:

I modified that same blueprint and noticed that it does seem to work for zones other than the home zone. I changed the notification to use my telegram notify and that does work but again, there seems to be something about the home zone specifically that does not trigger this automation when running from a blueprint. I’ve set up a separate automation not using the blueprint and the home zone does seem to work. It’s a bit frustrating…

2 Likes

Any idea why this would not work from entering Home? Works great for my other zones, but not my Home. Strange.

Would you mind posting your automation config? I am having the same issue with the home zone. thank you!