Default turn-on brightness/color temperature for lights

Tags: #<Tag:0x00007f3263fbc858> #<Tag:0x00007f3263fbc600>

Purpose
This Blueprint allows you to select 1+ lights/light groups and their default brightness and color temperature. It also work for bulbs that only have brightness and do not have a color temperature option.

Why
This is useful for lights that do not have a default brightness/color temperature for when they turn on (like Sengled zigbee bulbs) and instead turn on to the state they were when they were turned off. So, if you set your lights at 10% in the evening then turned them off, they will be at 10% when you turn them on in the morning instead of 100% like you prefer.

Although Home Assistant’s Default Turn-on Value supports brightness and x/y color it does not color temperature. In addition, for lights that do have a Default Turn-on Value they sometimes do not quickly check for brightness when they are first physically powered on versus turned on by automation, UI, or smart switch.

blueprint:
  name: Default turn-on brightness and color temperature for light(s)
  description: Resets bulb(s)'s color and brightness when it turns on. Although Home
    Assistant has a Default Turn-on Value (https://www.home-assistant.io/integrations/light/#default-turn-on-values)
    for lights it does not support color temperature, and some bulbs (zigbee) do not 
    quickly check when they are first physically powered on versus turned on by 
    automation, UI, or smart switch.
  domain: automation
  input:
    target_lights:
      name: Lights
      description: 'The light(s) you want to auto reset to your default settings when 
        they turn on. For more than one, add a comma and no spaces between the full 
        entity names. Example: light.lamp_left,light.lamp_right'
      selector:
        entity:
          domain: light
    light_color_temperature:
      name: Color Temperature
      description: 'Choose the color temperature. Examples: Cool White: 154; Daylight
        White: 181; White: 250; Soft White: 370; Warm White: 454'
      default: 370
      selector:
        number:
          min: 154.0
          max: 500.0
          unit_of_measurement: mireds
          mode: slider
          step: 1.0
    light_brightness:
      name: Brightness
      description: Choose the brightness.
      default: 255
      selector:
        number:
          min: 1.0
          max: 255.0
          mode: slider
          step: 1.0
alias: Bulb toggle set to default (Soft White) (BP)
description: 'When a bulb goes from off to on (usually toggling the physical switch)
  it sends a light.turn_on to force the light to go to its default state, because
  physical toggle does not trigger the default state unless the light power is off
  for ~30 sec. (It does go to default instantly if toggled via software.

  This is useful when the bulb''s previous/current state is not what you want as default.'
trigger:
  platform: state
  entity_id: !input 'target_lights'
  
condition: []

action:
  choose:
    - conditions:
        - condition: template
          value_template: '{{ trigger.from_state.state == ''off'' }}'
      sequence:
        - service: light.turn_on
          data:
            color_temp: !input 'light_color_temperature'
            brightness: !input 'light_brightness'
            entity_id: '{{ trigger.entity_id }}'
  default: []
mode: parallel
max: 100

How can I have this on a Toggle Switch? I.e Press 1 button once, it turns on to desired colour and temp. Press same button again, it turns off light

It shouldn’t matter how the lights turn on as long as they are smart lights. The automation is triggered by the smart bulbs turning on then it sets the brightness/temperature.
Some of my bulbs turn on my smart switch, some by the regular light switch, and another by automation.

Thank you for this blueprint. Is there any way to use it with RGBW leds? I dont see a way of choosing white value

I’d be happy to modify or duplicate this blueprint for RGBW bulbs, but first I want to make sure this ability doesn’t already exist. Also, I don’t have an RGBW bulb so you’ll have to help answer this question.
Home Assistant has Default Turn-on Value which allows you to set brightness and color (using the xy_color option). This blueprint imitates that for color_temperature.

Does the white_value get set correctly in the xy_color choice or is the white_value completely independent from the white LED pixel(s)?

To test you can create a file called ‘light_profiles.csv’ in your config folder. Mine looks like this:
image

Let me know what you know/find.

The white_value is independent. Find below 2 examples for whites, one using xy and the other one by using dedicated white leds. Not sure if this is what you meant. Let me know if you need anything else and I will be ready to help :slight_smile:

xy (rgb):
effect_list: 0, 1, 2, 3, 4
brightness: 255
hs_color: 0, 0
rgb_color: 255, 255, 255
xy_color: 0.323, 0.329
effect: 0
friendly_name: Led_bajo_libreria
supported_features: 149

White dedicated Leds:
effect_list: 0, 1, 2, 3, 4
brightness: 255
white_value: 255
effect: 0
friendly_name: Led_bajo_libreria
supported_features: 149

So does “xy_color: 0.323, 0.329” and “white_value: 255” make the same color light?

Or do you have to have “rgb_color: 255, 255, 255” AND “xy_color: 0.323, 0.329” in order to get the same as just using “white_value: 255”?