Automation: Flash light specifiek color

Hi all, I am trying to get my light flashing a specific color in an automation. I am using the standard flash function in the automation. Like this:

action:
  - device_id: a2616fa36abc4784add1d3d6797f0366
    domain: light
    entity_id: light.tripod
    type: flash

I know it is possible with the turn_on function and then choose flash, bun then I have the problem that I have to configure that the lights turn off again (when it is daytime). But then they wil also turn off when it is night.

You could use the new if - then action, introduced with 2022.5:


  - if:
      - condition: state
        entity_id: binary_sensor.daylight
        state: 'on'
    then:
      - service: light.turn_on
        data:
          rgb_color:
            - 152
            - 42
            - 188
          flash: short
        target:
          entity_id:
            - light. tripod
    else:
      - device_id: a2616fa36abc4784add1d3d6797f0366
        domain: light
        entity_id: light. tripod
        type: flash


Perfect! Thanks a lot for the reply!