#Same result for several zones

1 messages · Page 1 of 1 (latest)

warm umbra
#

Hello everyone,

I have now marked several zones and I want exactly the same thing to happen when I enter them.
Can someone tell me how to add all the zones in the code so that they are treated equally?

zone.markt1
zone.markt2
zone.markt3
zone.markt4

alias: zone
description: ""
triggers:
  - trigger: zone
    entity_id: device_tracker.samsung_p69
    zone: zone.markt1
    event: enter
conditions: []
actions:
  - action: notify.mobile_app_iphone_von_vivian
    metadata: {}
    data:
      message: enters zone
mode: single
wet wasp
warm umbra
warm umbra
wet wasp
#

Honestly I really would use suggest using the UI 😅. Even if you prefer yaml, just setting it up in UI, going over to yaml mode and seeing what it looks like.

The code has changed pretty noticably and you're automation is using legacy code.

What you wanna do using the updated yaml for automations would look like this

triggers:
  - trigger: zone
    entity_id: ""
    zone: ""
    event: enter
  - trigger: zone
    entity_id: ""
    zone: ""
    event: enter```
blissful parrot
#

I'm trying to do a similar thing, trying to add notifications for ALL people to enter+leave ALL zones - there must be a better way than copy-pasting the same trigger dozens of times by now right? or a blueprint?

static lodge
#

What about just a state trigger on the person/device_tracker with no specific state?

#

It will fire anytime they change zone.

blissful parrot
#

hmm, something like this(taken from online, with stuff stripped out)?
trigger:

  • platform: state
    entity_id:
    • person.colby
    • person.brandon
      condition: []
      action:
#

I assume that will also show Away state? so home/away/work/away/home etc?

#

(my current long one says things like "Sunny got to home", "Sunny left home", "Sunny got to work" etc

static lodge
#

The states of a person are home, not_home (outside of any zone), or the friendly name of another zone they are in.

#

You can get the state into a message with templates and the trigger object {{ trigger.to_state }}

#

message: "{{ trigger.entity_id }} has entered {{ trigger.to_state }}"

blissful parrot
#

I was using something like:

#
  • data:
    message: "{% if (trigger.event) == "leave" %}\n {{ trigger.to_state.attributes.friendly_name
    }} left {{ trigger.zone.attributes.friendly_name }}\n{% else %}\n {{ trigger.to_state.attributes.friendly_name
    }} got to {{ trigger.zone.attributes.friendly_name }}\n{% endif %}\n"
#

looking back at my automations.yaml backup before I wiped that server (just in the process of setting everything back up) you can combine the people but not the zones or events (at least back then when I set it up)