diff --git a/homeassistant/components/zha/sensor.py b/homeassistant/components/zha/sensor.py index 94f57ed9a0b15e..b2d246c30959f0 100644 --- a/homeassistant/components/zha/sensor.py +++ b/homeassistant/components/zha/sensor.py @@ -24,6 +24,13 @@ def pass_through_formatter(value): return value +def illuminance_formatter(value): + """Convert Illimination data.""" + if value is None: + return None + return round(pow(10, ((value - 1) / 10000)), 1) + + def temperature_formatter(value): """Convert temperature data.""" if value is None: @@ -58,6 +65,7 @@ def pressure_formatter(value): TEMPERATURE: temperature_formatter, PRESSURE: pressure_formatter, ELECTRICAL_MEASUREMENT: active_power_formatter, + ILLUMINANCE: illuminance_formatter, GENERIC: pass_through_formatter, } diff --git a/tests/components/zha/test_sensor.py b/tests/components/zha/test_sensor.py index ec6af7f4aa196d..cd8f4ba72b2d37 100644 --- a/tests/components/zha/test_sensor.py +++ b/tests/components/zha/test_sensor.py @@ -139,7 +139,7 @@ async def async_test_pressure(hass, device_info): async def async_test_illuminance(hass, device_info): """Test illuminance sensor.""" await send_attribute_report(hass, device_info["cluster"], 0, 10) - assert_state(hass, device_info, '10', 'lx') + assert_state(hass, device_info, '1.0', 'lx') async def async_test_metering(hass, device_info):