Light hui & more-info card fixes#7397
Conversation
| min="1" | ||
| max="255" | ||
| min="0" | ||
| max="100" |
There was a problem hiding this comment.
By changing this the precision of the slider is now 2.55 times less
There was a problem hiding this comment.
and we now have rounding differences, not sure those are issues but something to consider
There was a problem hiding this comment.
True, but is that something a user needs? Having the 0..100 percent is much more user friendly, plus it mirrors what we already use for the rounded slider in the hui-light-card.
There was a problem hiding this comment.
The hui-light-card however for contrast is only dividing by 254 before Math.round() compared that the 255 what I used now. Change made by you some time ago (#4257).
There was a problem hiding this comment.
I didn't change the logic there, just moved the line ;-)
There was a problem hiding this comment.
The 254 is from the original light card #1874 think we should change that to 255.
|
I'm not in favor of the slider going to 0. More often than not, when using the slider one wants the min or max for the light. Now, selecting the min will take some precision to avoid turning the light off when there is a switch right there to turn it off. |
Yeah, I saw your comment in the old linked PR 😄. Is there really a use case for manually dimming a light to 1% or 99% specifically? Either way, my priority is to make it consistent. The light card with the round slider is currently going down to zero and switching off the light. The more-info card should follow that or we should change both to use 1..99 instead of 0..100. => How do we make a decision? So far the opinions seem to be rather split in half. |
|
I'm with Ian. In the middle of the night I often want to quickly turn on the light but as little as possible. |
|
I'm with Ian, too. Additionally to the already stated reasons I mostly open the more-info dialog only for brightness (1-255 / 1-100) or history. If I want to switch off a light very quick, I directly tap on the switch in the entity row. |
|
@Mariusthvdb please stop plugging custom ui features everywhere, we won't add that kind of option, especially not with the config bound to the entity. |
|
Sorry to have believed this was still in discussion.... I was merely responding to the @spacegaier s post where he mentioned this option.
really baffled by your response here. seems a bit harsh doesn't it? |
|
He never mentioned that it could be an option, just that it should be consistent? It might sound harsh, but PR's are simply not the place to request features. Also, there is a reason that custom UI was custom and not in core. |
|
I agree the slider should stay at min 1, if you want to turn it off you can just click the switch, that is even faster and easier. |
I responded to: and with my suggestion, opted there are valid uses cases for both situations. Well, that's a bit of a bold view. Enough said, let's make HA a(n even) better product. |
@spacegaier I don't personally use the light-card so did not notice that, but that should also have a min of 1 IMO |
|
I do think it should be a percentage and not 1-255. More user friendly. No one needs that type of detail and if they do run an automation |
|
I adjusted the PR based on the majority vote: Percentage going from 1 to 100 for the sliders + fixed a general issue with the pin coloring. |
|
|
||
| const brightness = | ||
| Math.round((stateObj.attributes.brightness / 254) * 100) || 0; | ||
| Math.round((stateObj.attributes.brightness / 255) * 100) || 0; |
There was a problem hiding this comment.
Should this be 1 now?
| Math.round((stateObj.attributes.brightness / 255) * 100) || 0; | |
| Math.round((stateObj.attributes.brightness / 255) * 100) || 1; |
There was a problem hiding this comment.
I am not sure, but I think no. If for some reason we get invalid brightness value so that the first part results in an NaN, then we should not switch on the light slightly dimmed at 1%, but it should stay at 0. Or am I missing something here?

Breaking change
Proposed change
Fix various issues with the light more-info card:
Slider did not go down to 0, so you could not turn off the light with itGlobal changes to
<ha-labeled-slider>:Before:
After:
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: