mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Add (some) of ZCL concentration clusters to ZHA component (#47590)
* Update registries.py Add concentration clusters recently added to zigpy * Update measurement.py Add concentration clusters recently added to ZigPy * Update sensor.py Add concentration clusters recently added to ZigPy * Update sensor.py remove unnecessary tabs * Update measurement.py remove unnecessary tabs * Update sensor.py Just adding CO and CO2 for now. * Update registries.py Just adding CO2 and CO for now. * Update measurement.py Just adding CO2 and CO for now * Update sensor.py import const CONCENTRATION_PARTS_PER_MILLION * Update registries.py removed trailing whitespace * Update sensor.py added extra blank lines and removed trailing whitespace * Update measurement.py added extra blank lines and removed trailing whitespace * Update sensor.py add device classes for CO and CO2
This commit is contained in:
parent
24db0ff956
commit
ee2658f9e6
@ -74,3 +74,31 @@ class TemperatureMeasurement(ZigbeeChannel):
|
|||||||
"config": (REPORT_CONFIG_MIN_INT, REPORT_CONFIG_MAX_INT, 50),
|
"config": (REPORT_CONFIG_MIN_INT, REPORT_CONFIG_MAX_INT, 50),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@registries.ZIGBEE_CHANNEL_REGISTRY.register(
|
||||||
|
measurement.CarbonMonoxideConcentration.cluster_id
|
||||||
|
)
|
||||||
|
class CarbonMonoxideConcentration(ZigbeeChannel):
|
||||||
|
"""Carbon Monoxide measurement channel."""
|
||||||
|
|
||||||
|
REPORT_CONFIG = [
|
||||||
|
{
|
||||||
|
"attr": "measured_value",
|
||||||
|
"config": (REPORT_CONFIG_MIN_INT, REPORT_CONFIG_MAX_INT, 0.000001),
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@registries.ZIGBEE_CHANNEL_REGISTRY.register(
|
||||||
|
measurement.CarbonDioxideConcentration.cluster_id
|
||||||
|
)
|
||||||
|
class CarbonDioxideConcentration(ZigbeeChannel):
|
||||||
|
"""Carbon Dioxide measurement channel."""
|
||||||
|
|
||||||
|
REPORT_CONFIG = [
|
||||||
|
{
|
||||||
|
"attr": "measured_value",
|
||||||
|
"config": (REPORT_CONFIG_MIN_INT, REPORT_CONFIG_MAX_INT, 0.000001),
|
||||||
|
}
|
||||||
|
]
|
||||||
|
@ -68,6 +68,8 @@ SINGLE_INPUT_CLUSTER_DEVICE_CLASS = {
|
|||||||
zcl.clusters.general.PowerConfiguration.cluster_id: SENSOR,
|
zcl.clusters.general.PowerConfiguration.cluster_id: SENSOR,
|
||||||
zcl.clusters.homeautomation.ElectricalMeasurement.cluster_id: SENSOR,
|
zcl.clusters.homeautomation.ElectricalMeasurement.cluster_id: SENSOR,
|
||||||
zcl.clusters.hvac.Fan.cluster_id: FAN,
|
zcl.clusters.hvac.Fan.cluster_id: FAN,
|
||||||
|
zcl.clusters.measurement.CarbonDioxideConcentration.cluster_id: SENSOR,
|
||||||
|
zcl.clusters.measurement.CarbonMonoxideConcentration.cluster_id: SENSOR,
|
||||||
zcl.clusters.measurement.IlluminanceMeasurement.cluster_id: SENSOR,
|
zcl.clusters.measurement.IlluminanceMeasurement.cluster_id: SENSOR,
|
||||||
zcl.clusters.measurement.OccupancySensing.cluster_id: BINARY_SENSOR,
|
zcl.clusters.measurement.OccupancySensing.cluster_id: BINARY_SENSOR,
|
||||||
zcl.clusters.measurement.PressureMeasurement.cluster_id: SENSOR,
|
zcl.clusters.measurement.PressureMeasurement.cluster_id: SENSOR,
|
||||||
|
@ -5,6 +5,8 @@ from typing import Any, Callable, Dict, List, Optional, Union
|
|||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
DEVICE_CLASS_BATTERY,
|
DEVICE_CLASS_BATTERY,
|
||||||
|
DEVICE_CLASS_CO,
|
||||||
|
DEVICE_CLASS_CO2,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
DEVICE_CLASS_HUMIDITY,
|
||||||
DEVICE_CLASS_ILLUMINANCE,
|
DEVICE_CLASS_ILLUMINANCE,
|
||||||
DEVICE_CLASS_POWER,
|
DEVICE_CLASS_POWER,
|
||||||
@ -14,6 +16,7 @@ from homeassistant.components.sensor import (
|
|||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
@ -279,3 +282,25 @@ class Temperature(Sensor):
|
|||||||
_device_class = DEVICE_CLASS_TEMPERATURE
|
_device_class = DEVICE_CLASS_TEMPERATURE
|
||||||
_divisor = 100
|
_divisor = 100
|
||||||
_unit = TEMP_CELSIUS
|
_unit = TEMP_CELSIUS
|
||||||
|
|
||||||
|
|
||||||
|
@STRICT_MATCH(channel_names="carbon_dioxide_concentration")
|
||||||
|
class CarbonDioxideConcentration(Sensor):
|
||||||
|
"""Carbon Dioxide Concentration sensor."""
|
||||||
|
|
||||||
|
SENSOR_ATTR = "measured_value"
|
||||||
|
_device_class = DEVICE_CLASS_CO2
|
||||||
|
_decimals = 0
|
||||||
|
_multiplier = 1e6
|
||||||
|
_unit = CONCENTRATION_PARTS_PER_MILLION
|
||||||
|
|
||||||
|
|
||||||
|
@STRICT_MATCH(channel_names="carbon_monoxide_concentration")
|
||||||
|
class CarbonMonoxideConcentration(Sensor):
|
||||||
|
"""Carbon Monoxide Concentration sensor."""
|
||||||
|
|
||||||
|
SENSOR_ATTR = "measured_value"
|
||||||
|
_device_class = DEVICE_CLASS_CO
|
||||||
|
_decimals = 0
|
||||||
|
_multiplier = 1e6
|
||||||
|
_unit = CONCENTRATION_PARTS_PER_MILLION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user