Correct ZHA illumination conversion (#23853)

* fix illumination values

* correct formula

* update illuminance calculation

* update test
This commit is contained in:
David F. Mulcahey authored and Paulus Schoutsen committed 2019-05-14 07:16:41 +02:00
1 parent 9b21774392
commit 128ce589e1
2 files changed
+9 -1

No files matched your search

+8
View File
@@ -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 @@ FORMATTER_FUNC_REGISTRY = {
TEMPERATURE: temperature_formatter,
PRESSURE: pressure_formatter,
ELECTRICAL_MEASUREMENT: active_power_formatter,
ILLUMINANCE: illuminance_formatter,
GENERIC: pass_through_formatter,
}