Update flux_led to use async_set_brightness in the lib (#60315)

This commit is contained in:
J. Nick Koston 2021-11-25 05:41:32 -06:00 committed by GitHub
parent a78f0eae39
commit 213be1f15e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 78 deletions

View file

@ -25,3 +25,8 @@ def _flux_color_mode_to_hass(flux_color_mode: str, flux_color_modes: set[str]) -
return COLOR_MODE_WHITE
return COLOR_MODE_BRIGHTNESS
return FLUX_COLOR_MODE_TO_HASS.get(flux_color_mode, COLOR_MODE_ONOFF)
def _effect_brightness(brightness: int) -> int:
"""Convert hass brightness to effect brightness."""
return round(brightness / 255 * 100)