Trying to use as little automations as possible to keep the overview about my system I ask myself if it is possible to check per actionable entity, if a condition specific to this entity evaluates to true, prior to performing said action.
One example I have is to lower the shutters on the westside partly, in the afternoon to prevent heating up of room temperature. This is mainly triggered by the suns azimuth crossing a certain value. I have other triggers such as the temperature, but lets keep it as simple as possible for this purpose.
To only close the shutters partly, I call cover.set_cover_position with a given value.
Now it could be that any of the shutters are already fully closed (Position 0), due to somebody sleeping or has been manually set to a position lower than the automation value. In which case these specific shutters should not be triggered by that automation.
Automation
- alias: Shutters - Close Shutters Partly to keep Heat out
id: 'shutters_close_shutters_partly_to_keep_heat_out'
trigger:
- platform: numeric_state
entity_id: sun.sun
value_template: "{{ state_attr('sun.sun', 'azimuth') }}"
above: 200 # sun shines at the west side of the house
condition:
- condition: template
value_template: >
{{ (state_attr('cover.bedroom', 'current_position') | float) > 40 or
(state_attr('cover.kids_room', 'current_position') | float) > 40 }}
action:
- service: cover.set_cover_position
data:
entity_id:
- cover.bedroom
- cover.kids_room
position: 40
Is there a solution to this that will prevent me from creating one automation per shutter?