Hi all:
I’d like to make an automation for controlling thermostats in each room based on whether window is open/closed in that room. I already created a group of binary_sensors to track window open/close in each room. However I’m struggling to find a smart way to create the trigger. So far I have tried:
(1) State change of the group binary_sensor: it works to trigger the automation however I don’t get trigger.entity_id for which individual window/door that changed state
(2) Trigger with template like below. This only get triggered when number of open windows changes from 0 to any number (when the state of template becomes true). However I’d like to trigger whenever the number of open window changes
trigger:
- platform: template
value_template: >-
{{ expand('binary_sensor.group_windows_doors')
| selectattr('state', 'eq', 'on')
| list
| count }}
id: window_door
(3) ChatGPT suggested to use state trigger but use template for entity_id like, but I can’t seem to get it to work.
entity_id: >
{{ expand('binary_sensor.group_windows_doors') | map(attribute='entity_id') | join(', ') }}
So I’m running out of ideas - any suggestion?