Default turn-on brightness/color temperature for lights

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.
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

Changelog

2021, Mar 3

Added My Home Assistant import link

2021, Jan 5

Initial commit

3 Likes

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”?

Thank you. This worked perfect for me. I like that I can have 1 automation to set the defaults for all my bulbs where required. Very simple, very elegant. No need for a csv file like before. Add new bulbs, just edit the automation to include them.

1 Like

Thank you, just what I needed and works perfect!

1 Like

hello @Noblewolf and thanks for this. It works great but i have one issue and you might be able to help.
I have various scenes that are linked to some lights. When I activate one of the scenes the brightness level is automatically adjusted to the brightness level that has been specified in the blue print instead of applying the brightness that it has been specified on the scene.

Example:
Scene-Bed time
Office Lights: OFF
Dinning Lights: OFF
Living room Lights: OFF
Bedroom Lights: 10% Brightness
Kitchen Spotlight: 10% Brightness
TV: OFF
HiFi: OFF

When I activate the scene all it executes but instead of 10% brightness for “Bedroom Lights” and “Kitchen Spotlight” it has something like 45% brightness, which is what i have set as the the default turn on value in the blueprint for each light entity indivitually.

I will appreciate it a lot if you can help me a bit here.

thank you in advance.

That’s a good explanation of the issue.

I’ve encountered the same thing myself, but haven’t been able to figure out how to solve it. I even have a thread explaining the problem and a few attempts I tried here: Using templating condition to check if a trigger.to_state attribute is empty/null/missing/etc

If anyone knows how to solve it let me know and I’ll update the blueprint.

X2 looking for a way to get around this same issue. It’s like we need to be able to choose which “version” of the light is turning on.

This is a great blueprint, thank you! After creating the automation from the blueprint, everything appears to work fine. However, after I turn off a light included within the automation, it will randomly turn back on. Sometimes within seconds, sometimes a bit later. When looking at what is turning it on, it shows turned on by service light.turn_on. Thoughts?

That is odd, but I don’t think it would be caused by this blueprint. It is only triggered by a light turning on and had no delay or wait conditions.

Many things could cause it. Could be a delay in a smart remote, another automation, script, cosmic radiation, gremlins, etc.
light.turn_on is the generic turn on command for lights that can be fired by anything that wants to turn a light on.

I just set this up and it works well, but one slight issue. When i try and activate a scene (for instance one that sets my bulb to coloured and turn on), this seems to override it and set it to white again. So my scenes only work when the light is already powered on.

Hi

Thanks for sharing this. I’ve got a couple of Shelly Dimmer2 modules controlling LED downlights but when I set this running via an automation, on one dimmer the lights turn on then immediately off again when I press the switch, but if I press the button two or three more times they then do stay on at the automation set brightness. With the other dimmer it seems to have no effect at all, no flashing but no effect on the turned on dimming level. Anything I can try?

cheers

Look at previous comments. This is a known issue that can’t currently be handled in a blueprint that I know of.
Maybe you could have a action after you turn on a scene to stop this automation, but I’ve not found a good way to do it.

That is quite unusual. Since the problem is with one switch and not others I’d say it doesn’t have to so with this blueprint. Also, there is no turn off command in the blueprint so I’d investigate elsewhere.

I’ve tested a bit more and its not working correctly with any of my four Shelly Dimmer2 switches.

The one I mentioned above turns the lights on at the correctly set dimming level by the automation but often turns them straight back off (or dims to zero within a second or so, not sure which), and the other three dimmers seem to ignore the automation entirely and just retain previous dim level as they would by default. I’ve compared configs of a dimmer that does nothing and the one that turns off when the automation is enabled and they’re identical so not sure what to look for. As soon as I turn off the automation the ones that don’t react to the automation obviously carry on as they were, and the other one starts working perfectly again from the wall switch, the Shelly app and from HA.

Setting turn-on brightness isn’t something I desperately need at the moment but happy to try things if you can suggest any troubleshooting steps.

Love the automation, but the Lovelace cards do not reset to the default color. Any suggestions?