1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Convert better from byte value to percentage in futurenow (#45042)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Lukáš Polívka 2021-02-15 12:33:13 +01:00 committed by GitHub
parent c8e04ee960
commit bed29fd4b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
def to_futurenow_level(level):
"""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):