🧯 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.