Need help with "warning light" automation

I have a Zigbee lighbulb controlled by a ZWave wall switch. By default, the light bulb should be around 3000K and controlled by the wall switch.
The automation i set up:

  1. When garage door opens, turn the light on, change color to purple
    Here is the automation I use:
alias: "Garage opening - Warning light on "
description: show indicator that any of the garage doors is opening
trigger:
  - platform: device
    device_id: cae9f564ca530bce7d7e3fbab26607b3
    domain: cover
    entity_id: c191ce8fc2bd8d7553dd5dfe2b4184b7
    type: opening
condition: []
action:
  - sequence:
      - type: turn_on
        device_id: 046e6019b114fad50b6012c9d0b649e1
        entity_id: a73ef4c5a0e984c4b0c5f63b4e08a034
        domain: switch
      - delay:
          hours: 0
          minutes: 0
          seconds: 0
          milliseconds: 500
      - action: light.turn_on
        target:
          entity_id:
            - light.mudroom_lightbulb_light
        data:
          rgb_color:
            - 255
            - 0
            - 255
          brightness_pct: 33
mode: single

  1. When garage door is fully closed, change light to 3000K and turn off
    Code:
alias: Garage closing - Warning light Off
description: ""
trigger:
  - platform: device
    device_id: cae9f564ca530bce7d7e3fbab26607b3
    domain: cover
    entity_id: c191ce8fc2bd8d7553dd5dfe2b4184b7
    type: closing
    enabled: true
  - platform: device
    device_id: cae9f564ca530bce7d7e3fbab26607b3
    domain: cover
    entity_id: c191ce8fc2bd8d7553dd5dfe2b4184b7
    type: closed
condition: []
action:
  - wait_for_trigger:
      - platform: state
        entity_id:
          - cover.ratgdov25i_1bf142_door
        from: closing
        to: closed
  - sequence:
      - action: light.turn_on
        target:
          entity_id:
            - light.mudroom_lightbulb_light
        data:
          kelvin: 3075
          brightness_pct: 33
      - delay:
          hours: 0
          minutes: 0
          seconds: 0
          milliseconds: 500
      - action: light.turn_off
        metadata: {}
        data: {}
        target:
          device_id: 9cd03b8ae196cfa6ed7a3430f7513bd7
        enabled: false
      - type: turn_off
        device_id: 046e6019b114fad50b6012c9d0b649e1
        entity_id: a73ef4c5a0e984c4b0c5f63b4e08a034
        domain: switch
mode: single

The trigger is a ratgdo controller, and they work well.
The problem is that the light bulb is switching to purple after the garage door is closed and before the light is turned off.
The next time I manually turn on the light, it is purple, not white.

Thank you for pointing me to my error.
Joe

In the second automation, try setting the delay time to be greater than 500 ms (at least 1-2 seconds) before turning off the light.

Perhaps it needs a bit more time to register being turned on to 3075 kelvin before it’s turned off.

1 Like

Looks like that additional delay in both automations did the trick.
Thank you

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.