use constant

This commit is contained in:
J. Nick Koston
2020-04-14 02:39:59 +00:00
parent 5b7d499533
commit 3ea41827f5
@@ -731,9 +731,9 @@ def create_list_of_entities(config, request):
def hue_brightness_to_hass(value):
"""Convert hue brightness 1..254 to hass format 0..255."""
return min(255, round((value / 254) * 255))
return min(255, round((value / HUE_API_STATE_HUE_MAX) * 255))
def hass_to_hue_brightness(value):
"""Convert hass brightness 0..255 to hue 1..254 scale."""
return max(1, round((value / 255) * 254))
return max(1, round((value / 255) * HUE_API_STATE_HUE_MAX))