Round illuminance value in ZHA integration (#84500)

This commit is contained in:
Maciej Bieniek 2022-12-23 13:24:15 +01:00 committed by GitHub
parent e2e272aeb6
commit a8f09b4063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -403,9 +403,9 @@ class Illuminance(Sensor):
_attr_name: str = "Illuminance"
_attr_native_unit_of_measurement = LIGHT_LUX
def formatter(self, value: int) -> float:
def formatter(self, value: int) -> int:
"""Convert illumination data."""
return round(pow(10, ((value - 1) / 10000)), 1)
return round(pow(10, ((value - 1) / 10000)))
@MULTI_MATCH(

View File

@ -129,7 +129,7 @@ async def async_test_pressure(hass, cluster, entity_id):
async def async_test_illuminance(hass, cluster, entity_id):
"""Test illuminance sensor."""
await send_attributes_report(hass, cluster, {1: 1, 0: 10, 2: 20})
assert_state(hass, entity_id, "1.0", LIGHT_LUX)
assert_state(hass, entity_id, "1", LIGHT_LUX)
async def async_test_metering(hass, cluster, entity_id):