Improve rounding the light level conversion in Lutron Caseta (#34167)

This commit is contained in:
Jason Swails 2020-04-13 18:07:32 -04:00 committed by GitHub
parent b0bb125860
commit 028e08c7f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,7 @@ _LOGGER = logging.getLogger(__name__)
def to_lutron_level(level):
"""Convert the given Home Assistant light level (0-255) to Lutron (0-100)."""
return int((level * 100) // 255)
return int(round((level * 100) / 255))
def to_hass_level(level):