I’d like to write sensible automations to support the following logic for our central ventilation unit. (I only need to change the intake airflow.) I’d like to have the following three states:
- Day mode (150 m²/h)
- Night mode (100 m²/h)
- Vacant mode (50 m²/h)
Now I’d like to switch between these values based on the state of the house. The transition between states is shown in the following state diagram.
Currently, I have implemented the desired behavior using 5 automations, each corresponding to a transition in the graph above; the Turns vacant
transition can be implemented only once, otherwise I’d have 6. For instance, here is the automation for setting the daily mode.
alias: 'Ventilation: Activate day mode'
description: ''
trigger:
- platform: time
at: '06:00:00'
condition:
- condition: numeric_state
entity_id: zone.home
above: '0'
action:
- service: input_select.select_option
data:
option: Daily
target:
entity_id: input_select.ventilation_mode
mode: single
Is there a better way than this? Can I write less automations (preferably a single one) to achieve the same result?
Can I write stateful automations? For instance, I can easily specify the conditions that define these states. Can HA then figure out which (if any) action is needed?
For example, the day mode may be active during 6AM-11PM if the house is occupied. Similarly the night mode, except the time-span is 11PM-6AM. If the house is vacant, the Vacant mode should be running.
So the question is, can I write automations by specifying states and not transitions?