AnthonMS / my-cards

Bundle of my custom Lovelace cards for Home Assistant. Includes: my-slider, my-slider-v2, my-button
Other
104 stars 27 forks source link

[Bug]: inverse not working with light temperature #63

Open snootched opened 1 month ago

snootched commented 1 month ago

Current Behavior

When attempting to use inverse: true for color temperature of light entity - invalid values calculated and fail to set on entity.

Expected Behavior

Default behaviour for color_temp is min=min_mireds and max=max_mireds (153 -> 500 for this light) Setting inverse: true should invert and set valid color_temp. (trying inverse as I would like to show the user an ascending kelvin scale and not mireds)

Alternatively - could add enhancement for setting color_temp_kelvin as kelvin in addition to mireds.

Steps To Reproduce

Using this basic config:

type: custom:my-slider-v2
entity: light.tv
mode: temperature
vertical: false
flipped: false
inverse: true
step: 1

Try to slide to either extent of the slider - error message will appear:

Failed to perform the action light/turn_on. value must be at least one for dictionary value @ data['color_temp']

Attributes for this entity:

min_color_temp_kelvin: 2000
max_color_temp_kelvin: 6535
min_mireds: 153
max_mireds: 500
supported_color_modes: color_temp, xy
color_mode: color_temp
brightness: 181
color_temp_kelvin: 6535
color_temp: 153
hs_color: 54.768, 1.6
rgb_color: 255, 254, 250
xy_color: 0.326, 0.333
mode: normal
dynamics: none
friendly_name: TV
supported_features: 40

Environment

- OS: container
- Node:
- Version:
- Hassio: 2024.10.1

Anything else?

No response