Light template dimmer

Is there a way to combine two sliders of a regular dimmable cct light bulb? To have the light at warm white when it is dimmed and cold white when it is bright. Am I thinking in the right direction by having to create template for that? Any suggestions or solutions?

I’d do it with an automation, trigger on change of brightness, action sets the colour temperature.

Map the brightness to colour temperature with a linear equation (bri = 0-255 -> k= 2000-6000 or whatever range of temperature you want), so yes a template would be required. For the above range it would be k = ( bri*15.7 + 2000 ) | int

That sounds really promising. I need to learn how to use brightness as a trigger. I’ll try that and see if it suits my needs. Or can you share your template yaml?

There is no attribute trigger so the best way to do it would be to create a template sensor for the brightness:

  - platform: template
        friendly_name: "My Light Brightness"
        value_template: "{{ state_attr('light.your_light_here', 'brightness') }}"

The the automation becomes:

  - alias: light_brightness_to_colour
      platform: state
      entity_id: sensor.my_light_brightness
      condition: state
      entity_id: light.your_light_here
      state: 'on'
      service: light.turn_on
      entity_id: light.your_light_here
        brightness: "{{ ( 15.7 * states('sensor.my_light_brightness')|int + 2000 )|int }}"

The condition is required as the state of the brightness attribute (and thus template sensor ) becomes None when the light is off and as the trigger occurs on any change of the sensor state we do not want that passed to the template which is expecting a number for the equation.