Okay, i tried the following:
trigger:
- platform: state
entity_id:
- binary_sensor.openclose_5
- binary_sensor.openclose_6
- binary_sensor.openclose_7
- binary_sensor.openclose_8
- binary_sensor.openclose_15
- binary_sensor.openclose_16
- binary_sensor.tur_fensterkontakt
- binary_sensor.tur_fensterkontakt_2
for:
seconds: 15
condition: []
action:
- service: climate.turn_off
target:
entity_id: "{{trigger.entity_id | area_name | area_entities | select('match', 'climate') | list}}"
This shows an error when trying to save the automation:
Message malformed: not a valid value for dictionary value @ data[‘action’][0][‘target’][‘entity_id’]
I then tried the following which saves without an error:
trigger:
- platform: state
entity_id:
- binary_sensor.openclose_5
- binary_sensor.openclose_6
- binary_sensor.openclose_7
- binary_sensor.openclose_8
- binary_sensor.openclose_15
- binary_sensor.openclose_16
- binary_sensor.tur_fensterkontakt
- binary_sensor.tur_fensterkontakt_2
condition: []
action:
- service_template: >-
{% if is_state('trigger.to_state', 'off') %} climate.turn_off {% else %}
climate.turn_on {% endif %}
target:
entity_id: >-
{{ area_entities(area_name(trigger.entity_id)) | select('match',
'climate') }}
But when executing nothing happens and the debugger says:
Error: Template rendered invalid entity IDs: <generator object select_or_reject at 0x7f7a71be40>
Any ideas how to solve this?