Generic zone interaction

Tags: #<Tag:0x00007f326fe2c590> #<Tag:0x00007f326fe2c450>

Introduction

This blueprint, allows you to easily define a sequence of actions, that are executed when a person enters or leaves a specific zone.
Even though this can be done relatively easily with a regular automation, I much prefer the blueprint interface to manage my automations.

Blueprint code

blueprint:
  name: Zone interaction action
  description: Perform an action when a person leaves or enters a specific zone
  domain: automation
  input:
    person_entity:
      name: Person
      description: The person you want to track
      selector:
        entity:
          domain: person
    zone_entity:
      name: Zone
      description: The zone you want to monitor
      selector:
        entity:
          domain: zone
    entering_action:
      name: Action(s) when entering
      description: The action(s) to trigger when the person enters the zone
      default: []
      selector:
        action:
    leaving_action:
      name: Action(s) when leaving
      description: The action(s) to trigger when the person leaves the zone
      default: []
      selector:
        action:

trigger:
  - platform: zone
    entity_id: !input person_entity
    zone: !input zone_entity
    event: leave
  - platform: zone
    entity_id: !input person_entity
    zone: !input zone_entity
    event: enter

action:
  - choose:
      # IF entering zone
      - conditions: >
          {{ trigger.event == 'enter' }}
        sequence: !input entering_action
      # ELIF leaving zone
      - conditions: >
          {{ trigger.event == 'leave' }}
        sequence: !input leaving_action
    # ELSE other zone state changed
    default: []

Plan for updates

  • Allow for multiple person entities (if and when blueprint selectors will allow multiple entities)
1 Like