Revert to simple multiple entity selector

Simplifies sensor selection back to multiple entity selector instead of complex target/area approach. More reliable and straightforward while still supporting multiple sensors.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-05 17:41:10 -08:00
parent b612412470
commit d338a7298a

View File

@@ -5,12 +5,12 @@ blueprint:
input:
occupancy_sensors:
name: Occupancy Sensors
description: Occupancy sensors to monitor (can select individual sensors or entire areas)
description: Binary sensors that detect occupancy/presence in the area
selector:
target:
entity:
domain: binary_sensor
device_class: occupancy
entity:
domain: binary_sensor
device_class: occupancy
multiple: true
lights:
name: Lights
description: Light entities to control
@@ -69,33 +69,17 @@ blueprint:
step: 1
unit_of_measurement: seconds
variables:
sensors: >
{% if occupancy_sensors.entity_id is defined %}
{{ occupancy_sensors.entity_id }}
{% elif occupancy_sensors.area_id is defined %}
{{ area_entities(occupancy_sensors.area_id) | select('match', 'binary_sensor.*') | select('device_attr', 'device_class', 'occupancy') | list }}
{% else %}
[]
{% endif %}
trigger:
- platform: event
event_type: state_changed
event_data:
domain: binary_sensor
- platform: state
entity_id: !input occupancy_sensors
condition:
- condition: template
value_template: "{{ trigger.event.data.entity_id in sensors }}"
- condition: template
value_template: "{{ state_attr(trigger.event.data.entity_id, 'device_class') == 'occupancy' }}"
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: "{{ expand(sensors) | selectattr('state', 'eq', 'on') | list | count > 0 }}"
value_template: "{{ expand(occupancy_sensors) | selectattr('state', 'eq', 'on') | list | count > 0 }}"
sequence:
- if:
- condition: template
@@ -115,12 +99,12 @@ action:
transition: !input turn_on_transition
- conditions:
- condition: template
value_template: "{{ expand(sensors) | selectattr('state', 'eq', 'on') | list | count == 0 }}"
value_template: "{{ expand(occupancy_sensors) | selectattr('state', 'eq', 'on') | list | count == 0 }}"
sequence:
- delay:
seconds: !input off_delay
- condition: template
value_template: "{{ expand(sensors) | selectattr('state', 'eq', 'on') | list | count == 0 }}"
value_template: "{{ expand(occupancy_sensors) | selectattr('state', 'eq', 'on') | list | count == 0 }}"
- action: light.turn_off
target: !input lights
data: