piitaya / lovelace-mushroom

Build a beautiful Home Assistant dashboard easily

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: light card color temperature slider does not show coldest temperatures

hcoohb opened this issue · comments

Current Behavior

When light has color temperature capability, HA displays the slider going from coldest to warmest temp as a blue to orange gradient.
Mushroom card shows the slider going from white to orange.
screenshot of both sliders

In your original implementation, the cold temp was correctly shown (and still on the readme example image), but later a PR #48 removed this to set to white as the coldest temp.
While I did see there was a technical reason, I do believe this is actually kind of a UI issue.

Couple of reason:

  • The most obvious is that by having white as coldest light: you don't know what color you are setting! Quite a few HA integrations have spent some time aligning the scales so that the white HA is really the white of the light. Using the mushroom card, I cannot exactly see where is the actual white lamp.
  • When you bring up the HA more info panel for that light, the scale shows to from blue to orange, so having a white to orange scale in mushroom card is inconsistent and will throw user off balance as it is not expected. (I did thought there was an issue with my setup until I dig through the code of the mushroom card...)
  • I would argue that having the light icon to match the color temp slider is less of a priority for good design than having consistent slider scale with HA and being able to set colors properly

Expected Behavior

Having the same color temperature slider as HA in the mushroom card.

Steps To Reproduce

No response

Environment

- OS: 
- Node:
- Version:
- Hassio: 2022.5.4

Anything else?

No response

The issue comes from the fact that homeassistant behaves rather inconsistently. The background color of the temperature slider does not match the color returned by the rgb_color attribute when the bulb changes color, as you can see below:
image
image
As you can see, the color shown by the icon and the color shown by the slider are different.
We can undoubtedly replicate the behavior of homeassistant, but as far as I'm concerned, it would only be able to confuse the user.
image
We could instead make sure to follow the color of the slider with the icon, but before posting yet another PR I would prefer to hear @piitaya 's opinion

I've opened an issue into the homeassistant's repo.

We can't follow the slider gradient because I think we can't detect that a light is in temp_color mode.
The icon color is based on rgb_color attributes.

@alessandroias Thanks for explaining that, I actually had never realized that the light icon color appear wrong on HA more info panel as well. Fixing that in HA would seem to be the first step. Thanks for opening an issue there!

But in the meantime we could basically replicate the HA behaviour in mushroom card. I.e: slider going from blue to orange, and light icon grey to orange.

@piitaya , I am not sure how mushroom card get the light details, but it seems (on my light at least) that the current color_mode and mi_red value is part of the attributes:
image
Not sure if that is the case for every light though.

if hass.states[entity_id].attributes.color_mode === "color_temp" is true its in color temp mode.

You probably don't want to adjust the color temp slider based on the brightness value of the light as it will be quite confusing when its all pale grey.