Automations: run action depends on timer

Hello,

is it possible to add if expression to action sections? I’d like to achieve something like this:

  • alias: Ventilation - max - off
    trigger:
    • platform: event
      event_type: timer.finished
      event_data:
      entity_id: timer.my_timer
    • platform: state
      entity_id: input_select.wietrzenie
      to: “OFF”
      condition:
      action:
    • service: fan.turn_off
      entity_id: fan.comfoairq
      when: hour > “22:00:00”
    • service: fan.turn_on
      entity_id: fan.comfoairq
      when: hour <= “22:00:00”

Please always properly format code snippets. When not formatted correctly it’s very difficult to read.

See Choose a Group of Actions.

This turns off the fan if the current hour is greater than 22 otherwise it turns it on.

action:
  - service: "fan.turn_{{ 'off' if now().hour > 22 else 'on' }}"
    entity_id: fan.comfoairq

Or you can select choose: from the actions dropdown.
This lets you set conditions for each different action