Track multiple people / zones - 228 automations reduced to 3!

What a beautiful blueprint, really happy with it … Only I come across the following …

I have neatly created Zones, which are also triggered when I get there. However, the notification works better for android and iphone.

On Iphone see screenshot, and on android the name of the zone is neatly displayed … What could this be in? Because I have not mentioned work in HA

1 Like

Very good, but how to get a friendly name of zone?

I don’t think this blueprint can do that, or more accurately I’m not sure how to do that!!

The reason for this is that it’s looking for the state of a “person” to change rather than a zone.

Sorry

I think I found a solution, but I haven’t tested it yet
{{ states.zone[trigger.to_state.state].name }}

If that does the trick then please do let me know and I’ll update the templates to use that so that everyone gets a better experience.

{{ states.zone[trigger.to_state.state].name }} works for me.

@Molot
Below is a quick and dirty way to notify via telegram.

blueprint:
  name: Telegram Notification All Zones
  description: Telegram Notification All Zones
  domain: automation
  input:
# Person/Device that will be tracked
    person_entity:
      name: Person
      description: Person/Device that will be tracked ? .
      selector:
        entity:
          domain: person
# Service to call for device that will be notified - have to type manually as can't select from a dropdown yet
    notify_device_1_1:
      name: Media Player Notification Service
      description: "HOW TO NOTIFY"
# Media device that will be notified
    notify_device_1_2:
      name: Media Device To Notify
      description: Telegram Bot to receive audio/tts notifications.
      selector:
        entity:
          domain: media_player

trigger:
  platform: state
  entity_id: !input person_entity

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

condition:
# Check that the old and new states(zones) are different
  condition: template
  value_template: "{{ trigger.from_state.state != trigger.to_state.state }}"

action:
# Send the message to the notification device with the chosen settings using notify
  - service: notify.notifier_telegram
    data:
      message: "{{ person_name }} has entered {{ trigger.to_state.state }}"

image

Thank you so much

some of the above is incorrect as to what each service does.

Hello, I am a bit confused as to what to put in replace of notify.alexa_media_living_room_echo_dot
I dont have any aleax devies in my house only google speakers but I dont understant what serive the notify.alexa is and if it is combatible with google

Another noob here would like to use this blueprint, can someone please let us know the correct syntax to use for google tts.
Specifically, I am asking about:

I have tried a bunch of different variations when creating the automation from this blueprint, but I’m just guessing and they are not working.

1 Like

I had the same Issue not to sure what to put.

Figured it out, the problem for me was in the action part.

have adjusted and will repost the blueprint that now works for me and google tts example

blueprint:
  name: 1 Person Multi-Zone Change - Audio Notification
  description: Send a notification to a device when a person enters a different zone.
  domain: automation
  input:
    # Person/Device that will be tracked
    person_entity:
      name: Person
      description: Person/Device that will be tracked.
      selector:
        entity:
          domain: person
    # Service to call for device that will be notified - have to type manually as can't select from a dropdown yet
    notify_device_1_1:
      name: Media Player Notification Service
      description: "Notifier service for Media Player to receive audio/tts notifications.  Example: tts.cloud_say"
    # Media device that will be notified
    notify_device_1_2:
      name: Media Player to notify
      description: Media Player to receive audio/tts notifications.
      selector:
        entity:
          domain: media_player

trigger:
  platform: state
  entity_id: !input person_entity

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

condition:
  # Check that the old and new states(zones) are different
  condition: template
  value_template: "{{ trigger.from_state.state != trigger.to_state.state }}"

action:
  # Send the message to the media device with the chosen settings using tts
  - service: !input notify_device_1_1
    data:
        entity_id: !input notify_device_1_2
        message: "{{ person_name }} has entered {{ states.zone[trigger.to_state.state].name }}"

One ‘problem’ I am having is the automation doesn’t like zones that are two words.

Hi, sorry for noob question but if i good understand, this code i put to this file?

/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml

or i create new file?
thx

1 Like

Were is the Blueprint url to be imported on HA?

Just found it.
Just past this url on your import blueprint field Track multiple people / zones - 228 automations reduced to 3! - #2 by Dean_James

Moved from {{ states.zone[trigger.from_state.state].name }}  to {{ states.zone[trigger.to_state.state].name }}

Does not work for me when the state is equal to not_home. All zones look nice, home is displayed as Home, but instead of not_home I get just nothing. So my notifications then look like "Moved from Home to " and “Moved from to Work”.

Moved from {{ trigger.from_state.state }} to {{ trigger.to_state.state }}

Works, but it is ugly - “Moved from home to not_home” and “Moved from not_home to Work”. Is there any simple way to make it nicer?

@hubikj - I’ve got a sensor which deals with this exact thing, it also works with zones to show the zone name nicely:

platform: template
sensors:
  xxx_location:
    friendly_name: xxx
    entity_picture_template: "{{ state_attr('person.xxx', 'entity_picture') }}"
    value_template:  >
      {% if is_state('device_tracker.iphone', 'home') %}
        Home
      {% elif is_state('device_tracker.iphone', 'not_home') %}
        {% if state_attr('sensor.iphone_geocoded_location', 'Sub Locality') != 'N/A' %}
          {{ state_attr('sensor.iphone_geocoded_location', 'Thoroughfare') }}, {{ state_attr('sensor.iphone_geocoded_location', 'Sub Locality') }}
        {% else %}
          {{ state_attr('sensor.iphone_geocoded_location', 'Thoroughfare') }}, {{ state_attr('sensor.iphone_geocoded_location', 'Locality') }}
        {% endif %}
      {% else %}
        {{ states('device_tracker.iphone') }}
      {% endif %}

is this abandoned? Im having an issue for the past few months of the condition failing.

Executed: March 29, 2022, 2:53:26 AM
Result:
result: false
entities: []

the condition:

condition: template
value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'

any ideas whats going on here?

edit: looks like its related to this Notify Entering Zone - #13 by DigitalFeonix

my zone.home is Home and the person.xx is home.

need to regx that template or soemthing, make it all the same case for Home. i just dont know how.