Add missing sensors to Tuya CO2 Detector (#131313)

pull/99570/head
Marco Aceti 2024-11-26 20:00:13 +01:00 committed by GitHub
parent f095aea5c3
commit 6e8f3d9393
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 38 additions and 0 deletions

View File

@ -292,6 +292,17 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
device_class=NumberDeviceClass.TEMPERATURE, device_class=NumberDeviceClass.TEMPERATURE,
), ),
), ),
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
NumberEntityDescription(
key=DPCode.ALARM_TIME,
translation_key="alarm_duration",
native_unit_of_measurement=UnitOfTime.SECONDS,
device_class=NumberDeviceClass.DURATION,
entity_category=EntityCategory.CONFIG,
),
),
} }

View File

@ -307,6 +307,15 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
), ),
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
SelectEntityDescription(
key=DPCode.ALARM_VOLUME,
translation_key="volume",
entity_category=EntityCategory.CONFIG,
),
),
} }
# Socket (duplicate of `kg`) # Socket (duplicate of `kg`)

View File

@ -214,6 +214,12 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
TuyaSensorEntityDescription(
key=DPCode.PM25_VALUE,
translation_key="pm25",
device_class=SensorDeviceClass.PM25,
state_class=SensorStateClass.MEASUREMENT,
),
*BATTERY_SENSORS, *BATTERY_SENSORS,
), ),
# Two-way temperature and humidity switch # Two-way temperature and humidity switch

View File

@ -11,6 +11,7 @@ from homeassistant.components.siren import (
SirenEntityDescription, SirenEntityDescription,
SirenEntityFeature, SirenEntityFeature,
) )
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -43,6 +44,14 @@ SIRENS: dict[str, tuple[SirenEntityDescription, ...]] = {
key=DPCode.SIREN_SWITCH, key=DPCode.SIREN_SWITCH,
), ),
), ),
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
SirenEntityDescription(
key=DPCode.ALARM_SWITCH,
entity_category=EntityCategory.CONFIG,
),
),
} }

View File

@ -119,6 +119,9 @@
} }
}, },
"number": { "number": {
"alarm_duration": {
"name": "Alarm duration"
},
"temperature": { "temperature": {
"name": "[%key:component::sensor::entity_component::temperature::name%]" "name": "[%key:component::sensor::entity_component::temperature::name%]"
}, },