diff --git a/custom_components/xiaomi_gateway3/core/converters/zigbee.py b/custom_components/xiaomi_gateway3/core/converters/zigbee.py index 18d4ec3a..03417418 100644 --- a/custom_components/xiaomi_gateway3/core/converters/zigbee.py +++ b/custom_components/xiaomi_gateway3/core/converters/zigbee.py @@ -386,6 +386,22 @@ def decode(self, device: "XDevice", payload: dict, data: dict): except: pass +@dataclass +class ZLifeControlHumidity(ZMathConv): + cluster_id = TemperatureMeasurement.cluster_id + attr_id = TemperatureMeasurement.AttributeDefs.min_measured_value.id + multiply: float = 0.01 + +@dataclass +class ZLifeControlECO2(ZMathConv): + cluster_id = TemperatureMeasurement.cluster_id + attr_id = TemperatureMeasurement.AttributeDefs.max_measured_value.id + +@dataclass +class ZLifeControlVOC(ZMathConv): + cluster_id = TemperatureMeasurement.cluster_id + attr_id = TemperatureMeasurement.AttributeDefs.tolerance.id + # Thanks to zigbee2mqtt: # https://github.com/Koenkk/zigbee-herdsman/blob/528b7626f2970ba87a0792920590926105a3cb48/src/zcl/definition/cluster.ts#LL460C32-L460C37 diff --git a/custom_components/xiaomi_gateway3/core/devices.py b/custom_components/xiaomi_gateway3/core/devices.py index 110c60c3..304d19c4 100644 --- a/custom_components/xiaomi_gateway3/core/devices.py +++ b/custom_components/xiaomi_gateway3/core/devices.py @@ -1317,6 +1317,15 @@ ZIASZoneConv("moisture", "binary_sensor"), ZBatteryPercConv("battery", "sensor", multiply=1.0), ], +}, { + "VOC_Sensor": ["LifeControl", "Air quality Sensor", "MCLH-08"], + "spec": [ + ZTemperatureConv("temperature", "sensor"), + ZLifeControlHumidity("humidity", "sensor"), + ZLifeControlECO2("eco_two", "sensor"), + ZLifeControlVOC("tvoc", "sensor"), + ZBatteryPercConv("battery", "sensor", multiply=1.0), + ], }, { "default": "zigbee", # default zigbee device "spec": [ diff --git a/custom_components/xiaomi_gateway3/hass/entity_description.py b/custom_components/xiaomi_gateway3/hass/entity_description.py index 785a73a4..632f5dc4 100644 --- a/custom_components/xiaomi_gateway3/hass/entity_description.py +++ b/custom_components/xiaomi_gateway3/hass/entity_description.py @@ -7,6 +7,7 @@ from homeassistant.const import ( CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER, CONCENTRATION_PARTS_PER_BILLION, + CONCENTRATION_PARTS_PER_MILLION, LIGHT_LUX, MAJOR_VERSION, MINOR_VERSION, @@ -86,6 +87,7 @@ "smoke_density": {"icon": "mdi:google-circles-communities", "units": "% obs/ft"}, "supply": {"icon": "mdi:gauge", "units": PERCENTAGE}, "tvoc": {"icon": "mdi:cloud", "units": CONCENTRATION_PARTS_PER_BILLION}, + "eco_two": {"name": "eCO2", "icon": "mdi:molecule-co2", "units": CONCENTRATION_PARTS_PER_MILLION}, ## # stats sensors "binary_sensor.gateway": {