šŸŒ Zone Notification Extended

I remember iOS notification had this issue when the tag wasnā€™t set. (I may need to find a default. For android it works flawlessly) Could you test it out? You also can trigger the automation just for your iOS device and share the trace log with me.

I may not have understood your response, but I reloaded the Extended Blueprint (shows version 3.5.2) but the slider is still 1 min steps. I thought I would see a duration to specify min, sec etc.

Should I be doing something different to get the 30 sec duration?

Thanks, that worked! If anyone needs the info, it stopped working after adding a device with a newer version of iOS.

Have you tried entering .5 in the text box? It shows red, but a saves fine. I havenā€™t tested, but it should work.

I didnā€™t make that change yet. Iā€™ll try to update the version today.

//EDIT: Iā€™d just updated the blueprint

  1. if no tag is defined the blueprint generates an random tag so iOS notifications should work again per default
  2. duration selector instead of a slider (breaking change) you may delete your duration value in yaml mode and define it again

Could you give an example on how you should do that inside the UI or YAML-code?
I canā€™t seem to grasp it, and would like to experiment with thisā€¦

Scenario:
If user is in a zone for 30 sec => Notification "{{user}} arrived at zone {{zone}};
If user !== in a zone for 30 sec => Notification ā€œ{{user}} passed through {{zone}}ā€
If user left the zone after more than 30 sec => "{{user}} left zone {{zone}} "

Could you please give me some directions, or give a hand in this?

Thanks for the suggestion. It appears to work! I will amend this if further testing shows up some issue, but none for now.

1 Like

Iā€™m getting an the following error when using the new blueprint:
Fout: UndefinedError: 'dict object' has no attribute 'entity_id'"
There are no other errors shown. (Could be the above error is because I was manually triggering the automation instead of the normal way)

Which is strange, because the blueprint worked perfectly before.
I do not recieve any notifications at all anymore, and Iā€™m sure the zone is for the tracked person is updated properly (checked using the entity status of the tracked person)

Iā€™m using iOS notifications, but nothing is recieved/sent.

Whe I go to developer tools, and change the current zone to another using the entity status editor, I also do not receive any notification on my iPhone.

@panhans Any idea whatā€™s wrong? Could I share some code with you so it could be fixed? I think there is a bug in the updated code unfortunatelyā€¦

Are you on the latest version? Could you trigger the automation and share the trace log with me? Thanks!

After a restart of HA the error disappears, although the notifications are not being sent out or recieved on my iPhone.

@panhans:
The logbook of HA itself (inside system => logbook) says:

Logger: homeassistant.helpers.template
Bron: helpers/template.py:2613
Eerst voorgekomen: 11:14:17 (1 gebeurtenissen)
Laatst gelogd: 11:14:17

Template variable warning: 'tag' is undefined when rendering '{{ iif(tag != '', tag, 'zne'+(range(1, 99999) | random | string)) }}'

And 1 second after that the following error is there in the system logbook:

Logger: homeassistant.components.mobile_app.notify
Bron: components/mobile_app/notify.py:199
integratie: Mobiele app (documentatie, problemen)
Eerst voorgekomen: 11:14:17 (2 gebeurtenissen)
Laatst gelogd: 11:14:18

[apns-collapse-id] header cannot be empty. This message is generated externally to Home Assistant.

Hello!! I love this notification setup, I just had a quick question. I am using it to track two people, and I would like to just have one notification per person, that replace each when the location is updated. Iā€™ve tried using ā€˜personā€™ as the tag but it doesnā€™t appear to work as I was hoping.

Sry, I totally missed your message. Is that still an issue? I just had a look into the code and I think this is fixed now.

Try zne-{{person}} for the tag. There is a typo in the description.

Hi,

the blueprint is worth its weight in gold and works great. However, there is one small thing that I am missing or I donā€™t know how it works exactly. Can I, or rather how can I add a tag to the notification when arriving or leaving the zone?

Normally this is done using the data field and then tag: xxx

Then it is possible to delete these messages automatically, for example after a certain time.

Many thanks in advance.

Ok last question , I am very close to having this set up perfectly. I am trying to use a simple custom condition using input boolean to have certain zones only trigger once per day. I am having trouble getting it working though , itā€™s not preventing the notification. Here is my custom conditionā€¦

  • condition: template
    value_template: >-
    {% if zone == ā€˜zone.huskyā€™ and
    is_state(ā€˜input_boolean.husky_notifiedā€™, ā€˜onā€™) %}
    false
    {% else %}
    true
    {% endif %}

Both the zone and boolean are referenced correctly

Try this:

{{ not (state_attr('zone.husky','friendly_name') == zone and is_state('input_boolean.husky_notified', 'on')) }}

Is it correct that you want to block the notification if the input boolean is on? If not just delete the not at the beginning of the expression.

Yeah thatā€™s what Iā€™m trying exactly. For some reason I cant get it to block the notification even with your template thoughā€¦seems pretty straightforward too. Maybe I am trying to do this the wrong way

Could you share your automation configuration in yaml?

Sure!

alias: Zone Notification Extended
description: ""
use_blueprint:
  path: panhans/zone_notification_extended.yaml
  input:
    notify_group: all_devices
    persons:
      - person.travis
      - person.wife
    zones_leaving:
      - zone.home
      - zone.local
      - zone.work
    zones:
      - zone.home
      - zone.fred_meyer
      - zone.husky
      - zone.local
      - zone.gpa
      - zone.pgate
      - zone.salon
      - zone.safeway
      - zone.sisters
      - zone.school
    custom_conditions: []
    title_arriving: "{{ person }}"
    message_arriving: "{{ person }} is at {{ zone }}."
    title_leaving: "{{ person }}"
    message_leaving: "{{ person }} left {{ zone }}."
    tag: zne-{{person}}
    critical_notification: true
    custom_conditions_arriving:
      - condition: template
        value_template: >-
          {{ not (state_attr('zone.husky','friendly_name') == zone and
          is_state('input_boolean.husky_notified', 'on')) }}

I have moved the template from custom conditions to arriving conditions and back a few times testing it. Neither way results in the notification not being sent. I have separate automations for triggering and resetting my boolean and theyā€™re working properly.

I didnā€™t change anything but it seems like it started working now :person_shrugging:

Edit: still not working

Ok, try this. Works for me:

{{ not (state_attr('zone.husky','friendly_name') | trim == zone_to | trim and is_state('input_boolean.husky_notified', 'on')) }}