šŸŒ Zone Notification Extended

Just check out ne version. Whitespaces will be ignored now.

Nice one - thanks
Iā€™ve also removed spaces anyway

Thanks again

1 Like

Ok, so the automation is triggered correctly but seems the notification got queued and send not immediately, is that correct? Youā€™re on iOS, right?

//EDIT: Seem iOS need a special treatment. I will provide you a test version tomorrow. Maybe setting this critical option solves your problem.

So, the symptoms are:

  • When I reach the zone (subdivision) boundary when leaving home, the automation seems to correctly detect that, at the appropriate place where my zone boundary ends, and immediately issues a notification. However, it issues a notification that Iā€™m arriving. I believe this is incorrect, as the transition is from ā€˜homeā€™ to ā€˜awayā€™ (or inside the zone to outside). This is the undesirable outcome.

  • When I return into the zone, it correctly identifies that Iā€™ve arrived back and immediately issues a correct notification. This is the desired outcome.

This zone boundary is 390 meters away from the house, so well outside of my local WiFi coverage.

Youā€™re correct that I am on IOS (iPhone 14 Pro running latest version of IOS), with good 5G coverage. (Although, Iā€™ve noticed there hasnā€™t been an update to the companion app since I installed it earlier this year.)

OK, thanks.

BTW, Critical notifications are enabled for HA on my phone.

Tomorrow, I need to be somewhere that I have access to a web browser, so maybe I can get a decent JSON trace while away from the house - that might help to see what happened when I left the zone.

1 Like

Didnā€™t get it. This is the history of the person state:

And here the timestamps of the triggered automation:

You only enabled arriving notifications. So you will get two notifications at 7:57 and 9:41

So now have a look at your screenshot:

Its 9:44. First notification 1 hour ago. Thatā€™s 8:44. Nothing changed that time. Latest notification 2min ago. 9:42. That fits somehow.

So it seems the first notification comes way too late since the automation got triggered at the right moment. Could you have a look into your companion app. On Android I got a notification history in companion settings. Could you check timestamps there?

However Iā€™ve added the critical notification setting to the blueprint. Maybe you check it out and test it again.

OK, maybe Iā€™m being a little dumb here and not fully understanding what I should be seeing.

Iā€™ve only done one trip today, which lasted ~ 1 hour or so. Before I started off, I cleared all the previous notifications from my phone so there were no old notifications hanging around. To my thinking, I should have only got one notification - when I arrived back home.

When I drove out of the gate from the subdivision, the phone pinged with a notification that I was arriving back (wrong), and that was around 8:00 am - I didnā€™t check the exact time, but around 8-ish would be in the right ballpark. So this first notification was in error. It wasnā€™t delayed, as it happened just as I transited the zone boundary. (Plus, Iā€™m curious as to why was it triggered twice 2 minutes apart at 7:57 am and 7:59 am? I wonder if somehow it thought Iā€™d dropped out of the zone after 7:57 am and reentered before 7:59 am, that would sort of explain it, but that should not have happened.)

When I got back an hour or so later (9:41 seems about right, as Iā€™d texted my wife at 9:34 saying I was heading back), I received the second notification as soon as I entered the subdivision (correct). Again, no discernible delay.

What am I missing?

Ya know, Iā€™m thinking maybe I should enable leaving and arriving notifications to see if it reports me leaving and then arriving back in the correct order (with correct timestamps)?

OK, it looks like it may be a phone issue. I enabled both departures and arrivals this morning, and got both as I was leaving the subdivision, 1 minute apart.

So, Iā€™m suspecting my phone is either losing the plot on the way out of the subdivision, or itā€™s somehow grabbing my WiFi network again. Either way, Iā€™ll try reducing the radius of the zone and see if that fixes the issue.

You can also try the default Zone Notification blueprint that ships with home assistant per default. Would be interesting if you experience with that the same issue.

If yes there is something wrong with your phone / app settings or your connection. Maybe you could play with the polling interval or other settings in companion app related to location service. Donā€™t know how it looks on iOS, but on android I have to change some settings for certain devices, e.g. pixel 4a. With my pixel 7 for example location updates work out of the box.

OK, Iā€™ll try the default Zone Notification to see if the symptoms change. However, this standard blueprint has very limited options for actions, which really doesnā€™t suit my needs.

Using your extended version, I just walked out of my subdivision and I got an erroneous ā€˜Arrivalā€™ message before I was half-way out of the zone. I then got a correct departure message when I was well outside the zone. I also go a correct arrival message when I walked back into the zone, albeit this was delayed fractionally. (BTW, I tried to download a Trace from my phone when I got the first erroneous Arrival message, but I have absolutely no idea where it is stored on the iPhone or how to retrieve it. Any ideas?)

Sadly, the IOS companion app doesnā€™t offer any form of tuning parameters, nor does IOS itself - itā€™s pretty much locked down - and annoyingly, thereā€™s no logging facility :frowning:

1 Like

OK, I think Iā€™ve solved the mystery. Itā€™s not a phone issue, but the way zones work in HA (and the way the blueprints handle them).

I have two overlapping zones: Home and Subdivision, both centered on my house. When Iā€™m home, Iā€™m clearly in both, but HA only allows a device tracker to be in one zone at a time, so it picks ā€˜Homeā€™. When I travel outside the subdivision, I cross the boundary between Home and Subdivision (still inside Subdivision) - thatā€™s where the erroneous ā€˜arrivingā€™ message comes from. As I continue out of the Subdivision zone, I get the ā€˜leavingā€™ message (as expected). When I arrive back in Subdivision, I get the ā€˜arrivalā€™ message (as expected). When I get closer to the house and enter the Home zone, it doesnā€™t give me a ā€˜departureā€™ notification, but quietly moves me from the Subdivision zone to the Home zone.

The solution was to modify my Home zone (in configuration.yaml) to have a much larger radius that encompasses the whole subdivision, and get rid of the Subdivision zone altogether. I tested it and it works as expected. Of course, the down side is that it makes using the person entityā€™s location to determine whether theyā€™re actually home or not problematic.

1 Like

Feature idea: It would be great if I could type a zone name instead of choosing a zone entity via the entity picker.

Example: I could set a zone around all of the grocery stores that I go to and call it ā€œGrocery Storeā€. Then I would type ā€œGrocery Storeā€ for the zone to match instead of choosing zone.grocery_store, zone.grocery_store_2, zone.grocery_store_3, etc.
Then I would use this blueprint to send me a notification with a link to my Home Assistant Shopping List.

Matching a zone name instead of choosing a zone entity would allow me to add more ā€œGrocery Storeā€ zones on my map without modifying this blueprint each time.

1 Like

So, you want to add some wildcard functionality. I think itā€™s a good addition to add two additional text fields (enter/leave) for that use case.

// Would you go with entity ids or with the friendly names?

I would use the Friendly Names. I think it would be simpler for a novice user as well.

1 Like

I just did a quick test. Works for me. If you want you can test it. When everything is fine I will merge it into the main branch.

hey @panhans, great work.

I am wondering if you can help with something that may be simple. I want to configure the message in the notification to include waze travel time.

e.g Person has left work, will be home in XX minutes

thanks

Iā€™d installed waze travel time integration on my test system. Thanks, I didnā€™t know it unit now. :wink:

Try this:

{{ person }} has left {{ zone }}, will be home in {{ state_attr('sensor.waze_travel_time','duration') | round() }} {{ state_attr('sensor.waze_travel_time','unit_of_measurement') }}.
1 Like

Hi I started using this but wondering if there is a way to only send a notification when my device stays in a location for a certain amount of time. As it stands now with my zones configured a lot of them are congested in the same area and every device is bombarded with notifications when Iā€™m simply passing through to another destination.

Another question I had was is there a way to switch the notifications from critical to a normal push notification? as it is now you are unable to silence them which for me is fine but for my wife she finds this to be very annoying.

Thank you for the work you have done!!!

1 Like
  1. Yes, there is a duration slider in blueprint settings. Maybe I have to change the selector.

  1. You and your wife are on iOS, right? I will add a toggle for critical notifications. That was more an experiment because someone here in the community had problems with receiving notifications.
1 Like