šŸ§Æ Person_Alert_Blueprint

Not really sure what you are asking.
You could certainly use the additional conditions to limit only certain zone change or people, and you could leave the entering and leaving blank, and only populate the leave and enter.
Read thru the documentation again and try some things.

The thing is that if you are counting on a jump from school to home, there canā€™t be any not_home between.

If you canā€™t use the BP direct, you could take pieces and parts of the BP and build your own automation.

Ah - thatā€™s the info that I missed, thanks for clarifying

Hi,
I installed your newest version of this blueprint and just want to create this task:

if (PersonA comes in zone ā€œmyHomeā€); then
set device x ā€œonā€ by ā€œ100ā€ brightness
fi

I created the automation with your blueprint, set my device an the zone ā€œmyHomeā€.
As ā€œEnter the Zone Actionā€ is defined:

  • set device x ā€œonā€ by ā€œ100ā€ brightness
  • notify my device with text ā€œtest coming homeā€

Begin and End Action time is 0 and the Day of the week to allow action is set for all days (default).
No ā€œAdditional conditionsā€ are defined.

After entering the zone ā€œmyHomeā€ I can see in the HA UI that the automation is triggert (shows last trigger about 1 minute ago).

I see this message in my logs:

[homeassistant.components.automation.coming_home_light] Error rendering variables: UndefinedError: 'dict object' has no attribute 'to_state'

Any ideas about this?

You are going to have to look at the trace to see what is happening and the zones to see what itā€™s state is.
Generally home is home, though, myHome, not sure what that is. If it is a zone you set to overlay the actual home, weird things can happen.

Sorry, my fault, my text about the zone ā€œmyHomeā€ is a little bit confusing.
I have only one zone defined which is my home address. I call it ā€œmyHomeā€ in my last post. The name in HA is ā€œhomeā€ (like ā€œhomeā€, not ā€œHomeā€ or ā€œhOmEā€ or something else).

I added now the following code to your BP:

trace:
    stored_traces: 25

to have a little bit more traces to investigate in this.

Thanks for the hint. I will come back with my results.

1 Like

So here is the corresponding trace:

It should go to the step under the arrow (i presume) .

Here is the step config which I struggle to find the problem:
My guess is there is something wrong in the conditions of ā€œHas Person arrived at Zone?ā€.

alias: Determine if there was an actionable event
choose:
  - conditions:
      - alias: Has Person arrived at Zone?
        condition: and
        conditions:
          - condition: template
            alias: person is in target zone
            value_template: '{{ to_state in friend_zone }}'
          - condition: template
            alias: person is arriving from another zone
            value_template: '{{ not from_state in friend_zone }}'
    sequence:
      - service: notify.mobile_app_chmp
        data:
          message: '1 Test is at home'
      - service: notify.notify
        data:
          message: 2 Test is at home
      - type: turn_on
        device_id: 90cb399ceaf3d1a46e27f844663093af
        entity_id: 53ee8ba0aa12919497ef715291c5e82e
        domain: light
        brightness_pct: 100
  - conditions:
      - alias: Person left Zone?
        condition: and
        conditions:
          - alias: Person was in Zone
            condition: template
            value_template: '{{ from_state in friend_zone }}'
          - alias: Person not in zone now
            condition: template
            value_template: '{{ not to_state in friend_zone }}'
    sequence: []
  - conditions:
      - alias: Person jumped from known zone to known zone
        condition: and
        conditions:
          - alias: Person left known zone
            condition: template
            value_template: '{{ from_state in friend_zone }}'
          - alias: Person arrived in known zone
            condition: template
            value_template: '{{ to_state in friend_zone }}'
    sequence: []

The trace is saying that trigger is probably to and from the same zone. Hard to say without the words but that is the most likely.

You don;'t need to post it here, just look at it yourself, but in the trace click the top asterix and then changed variables on the right. there it will tell you the from_state for person and zone, and the to_state person and zone. If they match then there was no zone change so it wonā€™t pick ā€˜left a zoneā€™, ā€˜entered a zoneā€™, or ā€˜left and entered a zoneā€™ in the decision tree at the bottom, which looks like the case.

There will be a trigger every few minutes where the GPS changes a few digits and the person doesnā€™t move far enough to change a zone. Those have to be screened out. Try to manually change te device location out of the zone and let it come back while testing.

For testing zones, this might helpā€¦

Hmm no that is not the problem. The ā€œchanged variablesā€ are showing

people2monitor_var:
  - person.chris
zone2monitor_var:
  - zone.home
friend_zone:
  - testzone
to_state: home
from_state: not_home

This seems to be ok.
So this looks like its fulfilled but does not start the ā€œHas Person arrived at Zone?ā€ step.

- alias: Has Person arrived at Zone?
        condition: and
        conditions:
          - condition: template
            alias: person is in target zone
            value_template: '{{ to_state in friend_zone }}'
          - condition: template
            alias: person is arriving from another zone
            value_template: '{{ not from_state in friend_zone }}'

Any other ideas to investigate?

I just wrote this up to help here and anywhere else when working with zones.
It might or might not help you @chris345433 but it should help others.

I realized the docs were a bit weak on this and in reading about 4 forum posts, I finally figured out how to do it myself, so I decided it should be pulled into a guide.

NEW UPDATE

All I did was change the default for the zone2monitor. No actual code changes.

However if you have a huge list of zones and are frustrated by having to edit your automation to add another zone when you add one to your HA install, this new template will just grab every zone you have and make it available for the BP to monitor and it updates itselfā€¦

This is the template:

'{{ states.zone | map(attribute="entity_id") | list }}'

:bookmark_tabs: Changelog

**2024-01-24**: Changed zones default to auto-list all zones.

Control issues? Everywhere ā€œJenā€ goes, you get a notification for where she is now?

She was afflicted with Muscular Dystrophy all her life, and wasnā€™t able to go anywhere on her own any more.
A week ago at the age of 41 she lost her battle with her disease and I only track her phone now, not her.

Be careful when you snap judge like that, you donā€™t know when you are going to make someone cryā€¦

1 Like

@Sir_Goodenough - First and foremost iā€™m sorry for your loss and for the trolls in this thread. Iā€™m sure she felt loved and got joy at you geeking out with home automation to make life a little bit better. I know my loved ones do.

Secondly thank you for this great automation bluepint and the support you have provided over the year.

Third, if you are up for it, might I impose on some of that tech support? Running into a weird issue - where the phone/app randomly freak out and think they are at multiple locations, which triggers this blueprint repeatedly (Home, school, home, school, home school), IOS GPS troubles aside i was curious if there is a way to add a ā€œtrigger delayā€ - something that says ā€œwait N seconds after person location is updated, and confirm they are still there before triggeringā€. Couldnā€™t tell based on the description of hold_period if this was the correct option or not.

Hold period is a delay between when the persons zone changes and the automation reports it.