mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Convert better from byte value to percentage in futurenow (#45042)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
c8e04ee960
commit
bed29fd4b1
@ -51,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
|
|
||||||
def to_futurenow_level(level):
|
def to_futurenow_level(level):
|
||||||
"""Convert the given Home Assistant light level (0-255) to FutureNow (0-100)."""
|
"""Convert the given Home Assistant light level (0-255) to FutureNow (0-100)."""
|
||||||
return int((level * 100) / 255)
|
return round((level * 100) / 255)
|
||||||
|
|
||||||
|
|
||||||
def to_hass_level(level):
|
def to_hass_level(level):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user