esphome / esphome/feature-requests

Enable relative color temperature changing

Open
#873 2 comments 7 reactions 0 assignees View on GitHub
component: light
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**

I would like to be able to set color temperature relative to the current color temperature of a light.
Currently, you can set relative brightness using `light.dim_relative` but to do the same with color temperature, you need to use a lambda.

Two possible paths:

1. Enable something like `id(light).color_temperature` as a lambda call. This would avoid the use of a global variable to track color temp.
2. Add a method to light that is `light.temp_relative` that works the same as `light.dim_relative` but for color temperature. The color temp would be changed relative to the defined `cold` and `warm` temperatures.

**Please describe your use case for this integration and alternatives you've tried:**

Current method:

```yaml
light:
- platform: cwww
name: "lights"
id: lightstrip
cold_white: pwm_cw
warm_white: pwm_ww
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 3000 K

globals:
- id: current_color_temp
type: float
restore_value: yes
initial_value: '222.2' #'0.4285' #4500K
- id: color_step_constant
type: float
initial_value: '34.8'

binary_sensor:
- platform: remote_receiver
id: "ktemp_up"
nec:
address: 0x00FF
command: 0xC23D
on_press:
then:
- light.turn_on:
id: vlightstrip
color_temperature: !lambda |-
id(current_color_temp) = constrain(id(current_color_temp) + id(color_step_constant), 153.85, 333.33);
return id(current_color_temp);
```

Desired future method:

```yaml
light:
- platform: cwww
name: "lights"
id: lightstrip
cold_white: pwm_cw
warm_white: pwm_ww
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 3000 K

binary_sensor:
- platform: remote_receiver
id: "ktemp_up"
nec:
address: 0x00FF
command: 0xC23D
on_press:
then:
- light.temp_relative:
id: lightstrip
relative_temperature: 10% #Percent increase based on color temp boundaries
```

**Additional context**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.