Fade on and fade off your selected lights

Just knocked this up this script and it may be useful to some people. It allows the following:

  • The fading on or off of any lights that can do so
  • Customizable transition times
  • Customizable delays until the fade begins
  • Custom start positions IE do you want your lights to transition from a set value

Feedback is welcome

sequence:
  - if:
      - condition: template
        value_template: "\"{{ custom_start }}\""
        alias: A custom light starting point was selected
    then:
      - target:
          entity_id: "{{ light_selection }}"
        data:
          rgb_color: "{{ color }}"
          brightness_pct: "{{ brightness_start }}"
        alias: Turn the Lights to their starting brightness and color
        action: light.turn_on
    alias: If a custom light starting value was selected, set that value
  - delay: "{{ delay }}"
    alias: The delay until the light starts fading on
  - action: light.turn_on
    metadata: {}
    data:
      transition: "{{ transition }}"
      brightness_pct: "{{ brightness_finish }}"
      rgb_color: "{{ color }}"
    target:
      entity_id: "{{ light_selection }}"
    alias: Fade the Lights to their selected brightness
fields:
  light_selection:
    name: 💡 Light Selection
    description: Lights to fade on
    selector:
      entity:
        multiple: true
        domain: light
    required: true
  color:
    selector:
      color_rgb: {}
    name: 🎨 Color
    description: What color should the light fade to?
    default:
      - 0
      - 0
      - 0
    required: true
  custom_start:
    selector:
      boolean: {}
    name: 🚀 Custom Start
    description: Customize your lights starting point? (Required for Brightness Start)
    required: true
    default: false
  brightness_start:
    selector:
      number:
        min: 0
        max: 100
        step: 1
    name: 🌙 Brightness Start
    description: what brightness should it start at?
    required: true
    default: 0
  brightness_finish:
    selector:
      number:
        min: 0
        max: 100
    name: ☀️ Brightness Finish
    description: what brightness should it reach?
    required: true
    default: 90
  transition:
    selector:
      number:
        min: 5
        max: 180
        step: 1
    name: 🔄 Transition
    description: How long should the fade on take? (in seconds)
    default: 130
    required: true
  delay:
    selector:
      number:
        min: 0
        max: 30
        step: 1
    name: ⏳ Delay
    description: The delay until the light starts fading on (in seconds)
    required: true
    default: 2
mode: restart
alias: Fade on the Selected Lights
description: Fade on the lights you wish with their respective brightness and color options
icon: mdi:weather-sunset-up