Round illuminance value in ZHA integration (#84500)
This commit is contained in:
parent
e2e272aeb6
commit
a8f09b4063
2 changed files with 3 additions and 3 deletions
|
@ -403,9 +403,9 @@ class Illuminance(Sensor):
|
||||||
_attr_name: str = "Illuminance"
|
_attr_name: str = "Illuminance"
|
||||||
_attr_native_unit_of_measurement = LIGHT_LUX
|
_attr_native_unit_of_measurement = LIGHT_LUX
|
||||||
|
|
||||||
def formatter(self, value: int) -> float:
|
def formatter(self, value: int) -> int:
|
||||||
"""Convert illumination data."""
|
"""Convert illumination data."""
|
||||||
return round(pow(10, ((value - 1) / 10000)), 1)
|
return round(pow(10, ((value - 1) / 10000)))
|
||||||
|
|
||||||
|
|
||||||
@MULTI_MATCH(
|
@MULTI_MATCH(
|
||||||
|
|
|
@ -129,7 +129,7 @@ async def async_test_pressure(hass, cluster, entity_id):
|
||||||
async def async_test_illuminance(hass, cluster, entity_id):
|
async def async_test_illuminance(hass, cluster, entity_id):
|
||||||
"""Test illuminance sensor."""
|
"""Test illuminance sensor."""
|
||||||
await send_attributes_report(hass, cluster, {1: 1, 0: 10, 2: 20})
|
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):
|
async def async_test_metering(hass, cluster, entity_id):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue