Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color temperature slider has a 13 place decimal #44822

Closed
3 tasks done
brayStorm opened this issue Dec 7, 2020 · 7 comments · Fixed by #46112
Closed
3 tasks done

Color temperature slider has a 13 place decimal #44822

brayStorm opened this issue Dec 7, 2020 · 7 comments · Fixed by #46112

Comments

@brayStorm
Copy link

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • I have tried a different browser to see if it is related to my browser.

The problem

Color temp slider on light cards has a 13 place decimal trailing behind the value.

Expected behavior

Just show a whole number.

Steps to reproduce

Adjust any color temperature on a light card.
It's more obvious on iOS, but still present in Firefox/Chrome/Edge/Safari

Environment

  • Home Assistant release with the issue: 0.118.5
  • Last working Home Assistant release (if known): None
  • Browser and browser version:
  • Operating system: iOS Companion App, Safari, Firefox, Chrome, Edge

State of relevant entities

Problem-relevant configuration

Javascript errors shown in your browser console/inspector

Additional information

color-temp screencap

@spacegaier
Copy link
Member

Can you please post the attributes of your light (from the HA dev tools). In my tests I have only full integer values, but I could imagine that depending of what the min/max mireds values are, that there might be some calculations that could result in float values.

@brayStorm
Copy link
Author

Sorry for the slow response!
I see now that the same trailing decimal is what ESPHome assigned to min_mireds.

min_mireds: 166.6666717529297
max_mireds: 500
effect_list:
  - Flicker
  - Random
  - None
  - Christmas
  - Strobe
brightness: 212
color_temp: 369
hs_color:
  - 0
  - 0
rgb_color:
  - 255
  - 255
  - 255
xy_color:
  - 0.323
  - 0.329
white_value: 204
effect: None
entity_id:
  - light.outsidebulb4
  - light.outsidebulb5
  - light.outsidebulb6
  - light.outside_flood1
  - light.outside_flood2
friendly_name: Front Sconces
icon: 'mdi:lightbulb-group'
supported_features: 191

@spacegaier
Copy link
Member

That's an interesting value 😄. But independent of whether that is correct or not, the frontend should probably round the value for the slider.

@spacegaier
Copy link
Member

spacegaier commented Jan 2, 2021

I checked the docs again and min_mireds and max_mireds should be integers. So rounding in the frontend is not be most suitable option.

https://developers.home-assistant.io/docs/core/entity/light/

I will have this issue transferred to the backend repo. The esphome integration should return an integer to fix this. Same applies to the Shelly integration that currently also returns a float.

@bramkragten bramkragten transferred this issue from home-assistant/frontend Jan 4, 2021
@probot-home-assistant
Copy link

shelly documentation
shelly source
(message by IssueLinks)

@probot-home-assistant
Copy link

esphome documentation
esphome source
(message by IssueLinks)

@thecode
Copy link
Member

thecode commented Feb 4, 2021

I checked the docs again and min_mireds and max_mireds should be integers. So rounding in the frontend is not be most suitable option.

https://developers.home-assistant.io/docs/core/entity/light/

I will have this issue transferred to the backend repo. The esphome integration should return an integer to fix this. Same applies to the Shelly integration that currently also returns a float.

Shelly integration has type error in the declaration,

def color_temp(self) -> Optional[float]:

but actually returns an int.
return int(color_temperature_kelvin_to_mired(color_temp))

image

@balloob the I can submit a PR to fix Shelly integration, but I think first stage should be to add types to LightEntity here:

class LightEntity(ToggleEntity):

Can you list of the expected types?

@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants