Use state/device/entity category enums in Tuya (#60788)
This commit is contained in:
parent
c875d726b1
commit
563b488739
9 changed files with 332 additions and 383 deletions
|
@ -6,21 +6,14 @@ from dataclasses import dataclass
|
||||||
from tuya_iot import TuyaDevice, TuyaDeviceManager
|
from tuya_iot import TuyaDevice, TuyaDeviceManager
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_DOOR,
|
BinarySensorDeviceClass,
|
||||||
DEVICE_CLASS_GAS,
|
|
||||||
DEVICE_CLASS_MOISTURE,
|
|
||||||
DEVICE_CLASS_MOTION,
|
|
||||||
DEVICE_CLASS_SAFETY,
|
|
||||||
DEVICE_CLASS_SMOKE,
|
|
||||||
DEVICE_CLASS_TAMPER,
|
|
||||||
DEVICE_CLASS_VIBRATION,
|
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC
|
|
||||||
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 import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import HomeAssistantTuyaData
|
from . import HomeAssistantTuyaData
|
||||||
|
@ -43,8 +36,8 @@ class TuyaBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||||
TAMPER_BINARY_SENSOR = TuyaBinarySensorEntityDescription(
|
TAMPER_BINARY_SENSOR = TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.TEMPER_ALARM,
|
key=DPCode.TEMPER_ALARM,
|
||||||
name="Tamper",
|
name="Tamper",
|
||||||
device_class=DEVICE_CLASS_TAMPER,
|
device_class=BinarySensorDeviceClass.TAMPER,
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +51,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"co2bj": (
|
"co2bj": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.CO2_STATE,
|
key=DPCode.CO2_STATE,
|
||||||
device_class=DEVICE_CLASS_SAFETY,
|
device_class=BinarySensorDeviceClass.SAFETY,
|
||||||
on_value="alarm",
|
on_value="alarm",
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
|
@ -68,12 +61,12 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"cobj": (
|
"cobj": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.CO_STATE,
|
key=DPCode.CO_STATE,
|
||||||
device_class=DEVICE_CLASS_SAFETY,
|
device_class=BinarySensorDeviceClass.SAFETY,
|
||||||
on_value="1",
|
on_value="1",
|
||||||
),
|
),
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.CO_STATUS,
|
key=DPCode.CO_STATUS,
|
||||||
device_class=DEVICE_CLASS_SAFETY,
|
device_class=BinarySensorDeviceClass.SAFETY,
|
||||||
on_value="alarm",
|
on_value="alarm",
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
|
@ -83,7 +76,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"hps": (
|
"hps": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.PRESENCE_STATE,
|
key=DPCode.PRESENCE_STATE,
|
||||||
device_class=DEVICE_CLASS_MOTION,
|
device_class=BinarySensorDeviceClass.MOTION,
|
||||||
on_value="presence",
|
on_value="presence",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -92,7 +85,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"jqbj": (
|
"jqbj": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.CH2O_STATE,
|
key=DPCode.CH2O_STATE,
|
||||||
device_class=DEVICE_CLASS_SAFETY,
|
device_class=BinarySensorDeviceClass.SAFETY,
|
||||||
on_value="alarm",
|
on_value="alarm",
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
|
@ -102,7 +95,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"jwbj": (
|
"jwbj": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.CH4_SENSOR_STATE,
|
key=DPCode.CH4_SENSOR_STATE,
|
||||||
device_class=DEVICE_CLASS_GAS,
|
device_class=BinarySensorDeviceClass.GAS,
|
||||||
on_value="alarm",
|
on_value="alarm",
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
|
@ -112,7 +105,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"mcs": (
|
"mcs": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.DOORCONTACT_STATE,
|
key=DPCode.DOORCONTACT_STATE,
|
||||||
device_class=DEVICE_CLASS_DOOR,
|
device_class=BinarySensorDeviceClass.DOOR,
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
),
|
),
|
||||||
|
@ -122,8 +115,8 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.TEMPER_ALARM,
|
key=DPCode.TEMPER_ALARM,
|
||||||
name="Tamper",
|
name="Tamper",
|
||||||
device_class=DEVICE_CLASS_TAMPER,
|
device_class=BinarySensorDeviceClass.TAMPER,
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
),
|
),
|
||||||
|
@ -132,7 +125,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"pir": (
|
"pir": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.PIR,
|
key=DPCode.PIR,
|
||||||
device_class=DEVICE_CLASS_MOTION,
|
device_class=BinarySensorDeviceClass.MOTION,
|
||||||
on_value="pir",
|
on_value="pir",
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
|
@ -142,7 +135,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"pm2.5": (
|
"pm2.5": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.PM25_STATE,
|
key=DPCode.PM25_STATE,
|
||||||
device_class=DEVICE_CLASS_SAFETY,
|
device_class=BinarySensorDeviceClass.SAFETY,
|
||||||
on_value="alarm",
|
on_value="alarm",
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
|
@ -152,12 +145,12 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"rqbj": (
|
"rqbj": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.GAS_SENSOR_STATUS,
|
key=DPCode.GAS_SENSOR_STATUS,
|
||||||
device_class=DEVICE_CLASS_GAS,
|
device_class=BinarySensorDeviceClass.GAS,
|
||||||
on_value="alarm",
|
on_value="alarm",
|
||||||
),
|
),
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.GAS_SENSOR_STATE,
|
key=DPCode.GAS_SENSOR_STATE,
|
||||||
device_class=DEVICE_CLASS_GAS,
|
device_class=BinarySensorDeviceClass.GAS,
|
||||||
on_value="1",
|
on_value="1",
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
|
@ -167,7 +160,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"sj": (
|
"sj": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.WATERSENSOR_STATE,
|
key=DPCode.WATERSENSOR_STATE,
|
||||||
device_class=DEVICE_CLASS_MOISTURE,
|
device_class=BinarySensorDeviceClass.MOISTURE,
|
||||||
on_value="alarm",
|
on_value="alarm",
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
|
@ -177,7 +170,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"sos": (
|
"sos": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.SOS_STATE,
|
key=DPCode.SOS_STATE,
|
||||||
device_class=DEVICE_CLASS_SAFETY,
|
device_class=BinarySensorDeviceClass.SAFETY,
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
),
|
),
|
||||||
|
@ -186,7 +179,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"voc": (
|
"voc": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.VOC_STATE,
|
key=DPCode.VOC_STATE,
|
||||||
device_class=DEVICE_CLASS_SAFETY,
|
device_class=BinarySensorDeviceClass.SAFETY,
|
||||||
on_value="alarm",
|
on_value="alarm",
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
|
@ -208,12 +201,12 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
"ywbj": (
|
"ywbj": (
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.SMOKE_SENSOR_STATUS,
|
key=DPCode.SMOKE_SENSOR_STATUS,
|
||||||
device_class=DEVICE_CLASS_SMOKE,
|
device_class=BinarySensorDeviceClass.SMOKE,
|
||||||
on_value="alarm",
|
on_value="alarm",
|
||||||
),
|
),
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
key=DPCode.SMOKE_SENSOR_STATE,
|
key=DPCode.SMOKE_SENSOR_STATE,
|
||||||
device_class=DEVICE_CLASS_SMOKE,
|
device_class=BinarySensorDeviceClass.SMOKE,
|
||||||
on_value="1",
|
on_value="1",
|
||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
TAMPER_BINARY_SENSOR,
|
||||||
|
@ -225,7 +218,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||||
key=f"{DPCode.SHOCK_STATE}_vibration",
|
key=f"{DPCode.SHOCK_STATE}_vibration",
|
||||||
dpcode=DPCode.SHOCK_STATE,
|
dpcode=DPCode.SHOCK_STATE,
|
||||||
name="Vibration",
|
name="Vibration",
|
||||||
device_class=DEVICE_CLASS_VIBRATION,
|
device_class=BinarySensorDeviceClass.VIBRATION,
|
||||||
on_value="vibration",
|
on_value="vibration",
|
||||||
),
|
),
|
||||||
TuyaBinarySensorEntityDescription(
|
TuyaBinarySensorEntityDescription(
|
||||||
|
|
|
@ -7,9 +7,9 @@ from tuya_iot import TuyaDevice, TuyaDeviceManager
|
||||||
|
|
||||||
from homeassistant.components.button import ButtonEntity, ButtonEntityDescription
|
from homeassistant.components.button import ButtonEntity, ButtonEntityDescription
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ENTITY_CATEGORY_CONFIG
|
|
||||||
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 import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import HomeAssistantTuyaData
|
from . import HomeAssistantTuyaData
|
||||||
|
@ -26,31 +26,31 @@ BUTTONS: dict[str, tuple[ButtonEntityDescription, ...]] = {
|
||||||
key=DPCode.RESET_DUSTER_CLOTH,
|
key=DPCode.RESET_DUSTER_CLOTH,
|
||||||
name="Reset Duster Cloth",
|
name="Reset Duster Cloth",
|
||||||
icon="mdi:restart",
|
icon="mdi:restart",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
ButtonEntityDescription(
|
ButtonEntityDescription(
|
||||||
key=DPCode.RESET_EDGE_BRUSH,
|
key=DPCode.RESET_EDGE_BRUSH,
|
||||||
name="Reset Edge Brush",
|
name="Reset Edge Brush",
|
||||||
icon="mdi:restart",
|
icon="mdi:restart",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
ButtonEntityDescription(
|
ButtonEntityDescription(
|
||||||
key=DPCode.RESET_FILTER,
|
key=DPCode.RESET_FILTER,
|
||||||
name="Reset Filter",
|
name="Reset Filter",
|
||||||
icon="mdi:air-filter",
|
icon="mdi:air-filter",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
ButtonEntityDescription(
|
ButtonEntityDescription(
|
||||||
key=DPCode.RESET_MAP,
|
key=DPCode.RESET_MAP,
|
||||||
name="Reset Map",
|
name="Reset Map",
|
||||||
icon="mdi:map-marker-remove",
|
icon="mdi:map-marker-remove",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
ButtonEntityDescription(
|
ButtonEntityDescription(
|
||||||
key=DPCode.RESET_ROLL_BRUSH,
|
key=DPCode.RESET_ROLL_BRUSH,
|
||||||
name="Reset Roll Brush",
|
name="Reset Roll Brush",
|
||||||
icon="mdi:restart",
|
icon="mdi:restart",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,38 +7,12 @@ from enum import Enum
|
||||||
|
|
||||||
from tuya_iot import TuyaCloudOpenAPIEndpoint
|
from tuya_iot import TuyaCloudOpenAPIEndpoint
|
||||||
|
|
||||||
|
from homeassistant.components.sensor import SensorDeviceClass
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER,
|
CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER,
|
||||||
CONCENTRATION_PARTS_PER_BILLION,
|
CONCENTRATION_PARTS_PER_BILLION,
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
DEVICE_CLASS_AQI,
|
|
||||||
DEVICE_CLASS_BATTERY,
|
|
||||||
DEVICE_CLASS_CO,
|
|
||||||
DEVICE_CLASS_CO2,
|
|
||||||
DEVICE_CLASS_CURRENT,
|
|
||||||
DEVICE_CLASS_DATE,
|
|
||||||
DEVICE_CLASS_ENERGY,
|
|
||||||
DEVICE_CLASS_GAS,
|
|
||||||
DEVICE_CLASS_HUMIDITY,
|
|
||||||
DEVICE_CLASS_ILLUMINANCE,
|
|
||||||
DEVICE_CLASS_MONETARY,
|
|
||||||
DEVICE_CLASS_NITROGEN_DIOXIDE,
|
|
||||||
DEVICE_CLASS_NITROGEN_MONOXIDE,
|
|
||||||
DEVICE_CLASS_NITROUS_OXIDE,
|
|
||||||
DEVICE_CLASS_OZONE,
|
|
||||||
DEVICE_CLASS_PM1,
|
|
||||||
DEVICE_CLASS_PM10,
|
|
||||||
DEVICE_CLASS_PM25,
|
|
||||||
DEVICE_CLASS_POWER,
|
|
||||||
DEVICE_CLASS_POWER_FACTOR,
|
|
||||||
DEVICE_CLASS_PRESSURE,
|
|
||||||
DEVICE_CLASS_SIGNAL_STRENGTH,
|
|
||||||
DEVICE_CLASS_SULPHUR_DIOXIDE,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
DEVICE_CLASS_TIMESTAMP,
|
|
||||||
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
|
||||||
DEVICE_CLASS_VOLTAGE,
|
|
||||||
ELECTRIC_CURRENT_AMPERE,
|
ELECTRIC_CURRENT_AMPERE,
|
||||||
ELECTRIC_CURRENT_MILLIAMPERE,
|
ELECTRIC_CURRENT_MILLIAMPERE,
|
||||||
ELECTRIC_POTENTIAL_MILLIVOLT,
|
ELECTRIC_POTENTIAL_MILLIVOLT,
|
||||||
|
@ -355,33 +329,33 @@ UNITS = (
|
||||||
unit="",
|
unit="",
|
||||||
aliases={" "},
|
aliases={" "},
|
||||||
device_classes={
|
device_classes={
|
||||||
DEVICE_CLASS_AQI,
|
SensorDeviceClass.AQI,
|
||||||
DEVICE_CLASS_DATE,
|
SensorDeviceClass.DATE,
|
||||||
DEVICE_CLASS_MONETARY,
|
SensorDeviceClass.MONETARY,
|
||||||
DEVICE_CLASS_TIMESTAMP,
|
SensorDeviceClass.TIMESTAMP,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=PERCENTAGE,
|
unit=PERCENTAGE,
|
||||||
aliases={"pct", "percent"},
|
aliases={"pct", "percent"},
|
||||||
device_classes={
|
device_classes={
|
||||||
DEVICE_CLASS_BATTERY,
|
SensorDeviceClass.BATTERY,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
SensorDeviceClass.HUMIDITY,
|
||||||
DEVICE_CLASS_POWER_FACTOR,
|
SensorDeviceClass.POWER_FACTOR,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=CONCENTRATION_PARTS_PER_MILLION,
|
unit=CONCENTRATION_PARTS_PER_MILLION,
|
||||||
device_classes={
|
device_classes={
|
||||||
DEVICE_CLASS_CO,
|
SensorDeviceClass.CO,
|
||||||
DEVICE_CLASS_CO2,
|
SensorDeviceClass.CO2,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=CONCENTRATION_PARTS_PER_BILLION,
|
unit=CONCENTRATION_PARTS_PER_BILLION,
|
||||||
device_classes={
|
device_classes={
|
||||||
DEVICE_CLASS_CO,
|
SensorDeviceClass.CO,
|
||||||
DEVICE_CLASS_CO2,
|
SensorDeviceClass.CO2,
|
||||||
},
|
},
|
||||||
conversion_unit=CONCENTRATION_PARTS_PER_MILLION,
|
conversion_unit=CONCENTRATION_PARTS_PER_MILLION,
|
||||||
conversion_fn=lambda x: x / 1000,
|
conversion_fn=lambda x: x / 1000,
|
||||||
|
@ -389,73 +363,73 @@ UNITS = (
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=ELECTRIC_CURRENT_AMPERE,
|
unit=ELECTRIC_CURRENT_AMPERE,
|
||||||
aliases={"a", "ampere"},
|
aliases={"a", "ampere"},
|
||||||
device_classes={DEVICE_CLASS_CURRENT},
|
device_classes={SensorDeviceClass.CURRENT},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=ELECTRIC_CURRENT_MILLIAMPERE,
|
unit=ELECTRIC_CURRENT_MILLIAMPERE,
|
||||||
aliases={"ma", "milliampere"},
|
aliases={"ma", "milliampere"},
|
||||||
device_classes={DEVICE_CLASS_CURRENT},
|
device_classes={SensorDeviceClass.CURRENT},
|
||||||
conversion_unit=ELECTRIC_CURRENT_AMPERE,
|
conversion_unit=ELECTRIC_CURRENT_AMPERE,
|
||||||
conversion_fn=lambda x: x / 1000,
|
conversion_fn=lambda x: x / 1000,
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=ENERGY_WATT_HOUR,
|
unit=ENERGY_WATT_HOUR,
|
||||||
aliases={"wh", "watthour"},
|
aliases={"wh", "watthour"},
|
||||||
device_classes={DEVICE_CLASS_ENERGY},
|
device_classes={SensorDeviceClass.ENERGY},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=ENERGY_KILO_WATT_HOUR,
|
unit=ENERGY_KILO_WATT_HOUR,
|
||||||
aliases={"kwh", "kilowatt-hour", "kW·h"},
|
aliases={"kwh", "kilowatt-hour", "kW·h"},
|
||||||
device_classes={DEVICE_CLASS_ENERGY},
|
device_classes={SensorDeviceClass.ENERGY},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=VOLUME_CUBIC_FEET,
|
unit=VOLUME_CUBIC_FEET,
|
||||||
aliases={"ft3"},
|
aliases={"ft3"},
|
||||||
device_classes={DEVICE_CLASS_GAS},
|
device_classes={SensorDeviceClass.GAS},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=VOLUME_CUBIC_METERS,
|
unit=VOLUME_CUBIC_METERS,
|
||||||
aliases={"m3"},
|
aliases={"m3"},
|
||||||
device_classes={DEVICE_CLASS_GAS},
|
device_classes={SensorDeviceClass.GAS},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=LIGHT_LUX,
|
unit=LIGHT_LUX,
|
||||||
aliases={"lux"},
|
aliases={"lux"},
|
||||||
device_classes={DEVICE_CLASS_ILLUMINANCE},
|
device_classes={SensorDeviceClass.ILLUMINANCE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit="lm",
|
unit="lm",
|
||||||
aliases={"lum", "lumen"},
|
aliases={"lum", "lumen"},
|
||||||
device_classes={DEVICE_CLASS_ILLUMINANCE},
|
device_classes={SensorDeviceClass.ILLUMINANCE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
aliases={"ug/m3", "µg/m3", "ug/m³"},
|
aliases={"ug/m3", "µg/m3", "ug/m³"},
|
||||||
device_classes={
|
device_classes={
|
||||||
DEVICE_CLASS_NITROGEN_DIOXIDE,
|
SensorDeviceClass.NITROGEN_DIOXIDE,
|
||||||
DEVICE_CLASS_NITROGEN_MONOXIDE,
|
SensorDeviceClass.NITROGEN_MONOXIDE,
|
||||||
DEVICE_CLASS_NITROUS_OXIDE,
|
SensorDeviceClass.NITROUS_OXIDE,
|
||||||
DEVICE_CLASS_OZONE,
|
SensorDeviceClass.OZONE,
|
||||||
DEVICE_CLASS_PM1,
|
SensorDeviceClass.PM1,
|
||||||
DEVICE_CLASS_PM25,
|
SensorDeviceClass.PM25,
|
||||||
DEVICE_CLASS_PM10,
|
SensorDeviceClass.PM10,
|
||||||
DEVICE_CLASS_SULPHUR_DIOXIDE,
|
SensorDeviceClass.SULPHUR_DIOXIDE,
|
||||||
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER,
|
unit=CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER,
|
||||||
aliases={"mg/m3"},
|
aliases={"mg/m3"},
|
||||||
device_classes={
|
device_classes={
|
||||||
DEVICE_CLASS_NITROGEN_DIOXIDE,
|
SensorDeviceClass.NITROGEN_DIOXIDE,
|
||||||
DEVICE_CLASS_NITROGEN_MONOXIDE,
|
SensorDeviceClass.NITROGEN_MONOXIDE,
|
||||||
DEVICE_CLASS_NITROUS_OXIDE,
|
SensorDeviceClass.NITROUS_OXIDE,
|
||||||
DEVICE_CLASS_OZONE,
|
SensorDeviceClass.OZONE,
|
||||||
DEVICE_CLASS_PM1,
|
SensorDeviceClass.PM1,
|
||||||
DEVICE_CLASS_PM25,
|
SensorDeviceClass.PM25,
|
||||||
DEVICE_CLASS_PM10,
|
SensorDeviceClass.PM10,
|
||||||
DEVICE_CLASS_SULPHUR_DIOXIDE,
|
SensorDeviceClass.SULPHUR_DIOXIDE,
|
||||||
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
|
||||||
},
|
},
|
||||||
conversion_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
conversion_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
conversion_fn=lambda x: x * 1000,
|
conversion_fn=lambda x: x * 1000,
|
||||||
|
@ -463,69 +437,69 @@ UNITS = (
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=POWER_WATT,
|
unit=POWER_WATT,
|
||||||
aliases={"watt"},
|
aliases={"watt"},
|
||||||
device_classes={DEVICE_CLASS_POWER},
|
device_classes={SensorDeviceClass.POWER},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=POWER_KILO_WATT,
|
unit=POWER_KILO_WATT,
|
||||||
aliases={"kilowatt"},
|
aliases={"kilowatt"},
|
||||||
device_classes={DEVICE_CLASS_POWER},
|
device_classes={SensorDeviceClass.POWER},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=PRESSURE_BAR,
|
unit=PRESSURE_BAR,
|
||||||
device_classes={DEVICE_CLASS_PRESSURE},
|
device_classes={SensorDeviceClass.PRESSURE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=PRESSURE_MBAR,
|
unit=PRESSURE_MBAR,
|
||||||
aliases={"millibar"},
|
aliases={"millibar"},
|
||||||
device_classes={DEVICE_CLASS_PRESSURE},
|
device_classes={SensorDeviceClass.PRESSURE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=PRESSURE_HPA,
|
unit=PRESSURE_HPA,
|
||||||
aliases={"hpa", "hectopascal"},
|
aliases={"hpa", "hectopascal"},
|
||||||
device_classes={DEVICE_CLASS_PRESSURE},
|
device_classes={SensorDeviceClass.PRESSURE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=PRESSURE_INHG,
|
unit=PRESSURE_INHG,
|
||||||
aliases={"inhg"},
|
aliases={"inhg"},
|
||||||
device_classes={DEVICE_CLASS_PRESSURE},
|
device_classes={SensorDeviceClass.PRESSURE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=PRESSURE_PSI,
|
unit=PRESSURE_PSI,
|
||||||
device_classes={DEVICE_CLASS_PRESSURE},
|
device_classes={SensorDeviceClass.PRESSURE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=PRESSURE_PA,
|
unit=PRESSURE_PA,
|
||||||
device_classes={DEVICE_CLASS_PRESSURE},
|
device_classes={SensorDeviceClass.PRESSURE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=SIGNAL_STRENGTH_DECIBELS,
|
unit=SIGNAL_STRENGTH_DECIBELS,
|
||||||
aliases={"db"},
|
aliases={"db"},
|
||||||
device_classes={DEVICE_CLASS_SIGNAL_STRENGTH},
|
device_classes={SensorDeviceClass.SIGNAL_STRENGTH},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
unit=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
aliases={"dbm"},
|
aliases={"dbm"},
|
||||||
device_classes={DEVICE_CLASS_SIGNAL_STRENGTH},
|
device_classes={SensorDeviceClass.SIGNAL_STRENGTH},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=TEMP_CELSIUS,
|
unit=TEMP_CELSIUS,
|
||||||
aliases={"°c", "c", "celsius"},
|
aliases={"°c", "c", "celsius"},
|
||||||
device_classes={DEVICE_CLASS_TEMPERATURE},
|
device_classes={SensorDeviceClass.TEMPERATURE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=TEMP_FAHRENHEIT,
|
unit=TEMP_FAHRENHEIT,
|
||||||
aliases={"°f", "f", "fahrenheit"},
|
aliases={"°f", "f", "fahrenheit"},
|
||||||
device_classes={DEVICE_CLASS_TEMPERATURE},
|
device_classes={SensorDeviceClass.TEMPERATURE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=ELECTRIC_POTENTIAL_VOLT,
|
unit=ELECTRIC_POTENTIAL_VOLT,
|
||||||
aliases={"volt"},
|
aliases={"volt"},
|
||||||
device_classes={DEVICE_CLASS_VOLTAGE},
|
device_classes={SensorDeviceClass.VOLTAGE},
|
||||||
),
|
),
|
||||||
UnitOfMeasurement(
|
UnitOfMeasurement(
|
||||||
unit=ELECTRIC_POTENTIAL_MILLIVOLT,
|
unit=ELECTRIC_POTENTIAL_MILLIVOLT,
|
||||||
aliases={"mv", "millivolt"},
|
aliases={"mv", "millivolt"},
|
||||||
device_classes={DEVICE_CLASS_VOLTAGE},
|
device_classes={SensorDeviceClass.VOLTAGE},
|
||||||
conversion_unit=ELECTRIC_POTENTIAL_VOLT,
|
conversion_unit=ELECTRIC_POTENTIAL_VOLT,
|
||||||
conversion_fn=lambda x: x / 1000,
|
conversion_fn=lambda x: x / 1000,
|
||||||
),
|
),
|
||||||
|
|
|
@ -10,14 +10,12 @@ from tuya_iot import TuyaDevice, TuyaDeviceManager
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
ATTR_TILT_POSITION,
|
ATTR_TILT_POSITION,
|
||||||
DEVICE_CLASS_BLIND,
|
|
||||||
DEVICE_CLASS_CURTAIN,
|
|
||||||
DEVICE_CLASS_GARAGE,
|
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
SUPPORT_SET_TILT_POSITION,
|
SUPPORT_SET_TILT_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
|
CoverDeviceClass,
|
||||||
CoverEntity,
|
CoverEntity,
|
||||||
CoverEntityDescription,
|
CoverEntityDescription,
|
||||||
)
|
)
|
||||||
|
@ -53,21 +51,21 @@ COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
|
||||||
current_state=DPCode.SITUATION_SET,
|
current_state=DPCode.SITUATION_SET,
|
||||||
current_position=DPCode.PERCENT_STATE,
|
current_position=DPCode.PERCENT_STATE,
|
||||||
set_position=DPCode.PERCENT_CONTROL,
|
set_position=DPCode.PERCENT_CONTROL,
|
||||||
device_class=DEVICE_CLASS_CURTAIN,
|
device_class=CoverDeviceClass.CURTAIN,
|
||||||
),
|
),
|
||||||
TuyaCoverEntityDescription(
|
TuyaCoverEntityDescription(
|
||||||
key=DPCode.CONTROL_2,
|
key=DPCode.CONTROL_2,
|
||||||
name="Curtain 2",
|
name="Curtain 2",
|
||||||
current_position=DPCode.PERCENT_STATE_2,
|
current_position=DPCode.PERCENT_STATE_2,
|
||||||
set_position=DPCode.PERCENT_CONTROL_2,
|
set_position=DPCode.PERCENT_CONTROL_2,
|
||||||
device_class=DEVICE_CLASS_CURTAIN,
|
device_class=CoverDeviceClass.CURTAIN,
|
||||||
),
|
),
|
||||||
TuyaCoverEntityDescription(
|
TuyaCoverEntityDescription(
|
||||||
key=DPCode.CONTROL_3,
|
key=DPCode.CONTROL_3,
|
||||||
name="Curtain 3",
|
name="Curtain 3",
|
||||||
current_position=DPCode.PERCENT_STATE_3,
|
current_position=DPCode.PERCENT_STATE_3,
|
||||||
set_position=DPCode.PERCENT_CONTROL_3,
|
set_position=DPCode.PERCENT_CONTROL_3,
|
||||||
device_class=DEVICE_CLASS_CURTAIN,
|
device_class=CoverDeviceClass.CURTAIN,
|
||||||
),
|
),
|
||||||
# switch_1 is an undocumented code that behaves identically to control
|
# switch_1 is an undocumented code that behaves identically to control
|
||||||
# It is used by the Kogan Smart Blinds Driver
|
# It is used by the Kogan Smart Blinds Driver
|
||||||
|
@ -76,7 +74,7 @@ COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
|
||||||
name="Blind",
|
name="Blind",
|
||||||
current_position=DPCode.PERCENT_CONTROL,
|
current_position=DPCode.PERCENT_CONTROL,
|
||||||
set_position=DPCode.PERCENT_CONTROL,
|
set_position=DPCode.PERCENT_CONTROL,
|
||||||
device_class=DEVICE_CLASS_BLIND,
|
device_class=CoverDeviceClass.BLIND,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Garage Door Opener
|
# Garage Door Opener
|
||||||
|
@ -87,21 +85,21 @@ COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
|
||||||
name="Door",
|
name="Door",
|
||||||
current_state=DPCode.DOORCONTACT_STATE,
|
current_state=DPCode.DOORCONTACT_STATE,
|
||||||
current_state_inverse=True,
|
current_state_inverse=True,
|
||||||
device_class=DEVICE_CLASS_GARAGE,
|
device_class=CoverDeviceClass.GARAGE,
|
||||||
),
|
),
|
||||||
TuyaCoverEntityDescription(
|
TuyaCoverEntityDescription(
|
||||||
key=DPCode.SWITCH_2,
|
key=DPCode.SWITCH_2,
|
||||||
name="Door 2",
|
name="Door 2",
|
||||||
current_state=DPCode.DOORCONTACT_STATE_2,
|
current_state=DPCode.DOORCONTACT_STATE_2,
|
||||||
current_state_inverse=True,
|
current_state_inverse=True,
|
||||||
device_class=DEVICE_CLASS_GARAGE,
|
device_class=CoverDeviceClass.GARAGE,
|
||||||
),
|
),
|
||||||
TuyaCoverEntityDescription(
|
TuyaCoverEntityDescription(
|
||||||
key=DPCode.SWITCH_3,
|
key=DPCode.SWITCH_3,
|
||||||
name="Door 3",
|
name="Door 3",
|
||||||
current_state=DPCode.DOORCONTACT_STATE_3,
|
current_state=DPCode.DOORCONTACT_STATE_3,
|
||||||
current_state_inverse=True,
|
current_state_inverse=True,
|
||||||
device_class=DEVICE_CLASS_GARAGE,
|
device_class=CoverDeviceClass.GARAGE,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Curtain Switch
|
# Curtain Switch
|
||||||
|
@ -112,14 +110,14 @@ COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
|
||||||
name="Curtain",
|
name="Curtain",
|
||||||
current_position=DPCode.PERCENT_CONTROL,
|
current_position=DPCode.PERCENT_CONTROL,
|
||||||
set_position=DPCode.PERCENT_CONTROL,
|
set_position=DPCode.PERCENT_CONTROL,
|
||||||
device_class=DEVICE_CLASS_CURTAIN,
|
device_class=CoverDeviceClass.CURTAIN,
|
||||||
),
|
),
|
||||||
TuyaCoverEntityDescription(
|
TuyaCoverEntityDescription(
|
||||||
key=DPCode.CONTROL_2,
|
key=DPCode.CONTROL_2,
|
||||||
name="Curtain 2",
|
name="Curtain 2",
|
||||||
current_position=DPCode.PERCENT_CONTROL_2,
|
current_position=DPCode.PERCENT_CONTROL_2,
|
||||||
set_position=DPCode.PERCENT_CONTROL_2,
|
set_position=DPCode.PERCENT_CONTROL_2,
|
||||||
device_class=DEVICE_CLASS_CURTAIN,
|
device_class=CoverDeviceClass.CURTAIN,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Curtain Robot
|
# Curtain Robot
|
||||||
|
@ -129,7 +127,7 @@ COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
|
||||||
key=DPCode.CONTROL,
|
key=DPCode.CONTROL,
|
||||||
current_position=DPCode.PERCENT_STATE,
|
current_position=DPCode.PERCENT_STATE,
|
||||||
set_position=DPCode.PERCENT_CONTROL,
|
set_position=DPCode.PERCENT_CONTROL,
|
||||||
device_class=DEVICE_CLASS_CURTAIN,
|
device_class=CoverDeviceClass.CURTAIN,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ from dataclasses import dataclass
|
||||||
from tuya_iot import TuyaDevice, TuyaDeviceManager
|
from tuya_iot import TuyaDevice, TuyaDeviceManager
|
||||||
|
|
||||||
from homeassistant.components.humidifier import (
|
from homeassistant.components.humidifier import (
|
||||||
DEVICE_CLASS_DEHUMIDIFIER,
|
|
||||||
DEVICE_CLASS_HUMIDIFIER,
|
|
||||||
SUPPORT_MODES,
|
SUPPORT_MODES,
|
||||||
|
HumidifierDeviceClass,
|
||||||
HumidifierEntity,
|
HumidifierEntity,
|
||||||
HumidifierEntityDescription,
|
HumidifierEntityDescription,
|
||||||
)
|
)
|
||||||
|
@ -39,7 +38,7 @@ HUMIDIFIERS: dict[str, TuyaHumidifierEntityDescription] = {
|
||||||
key=DPCode.SWITCH,
|
key=DPCode.SWITCH,
|
||||||
dpcode=(DPCode.SWITCH, DPCode.SWITCH_SPRAY),
|
dpcode=(DPCode.SWITCH, DPCode.SWITCH_SPRAY),
|
||||||
humidity=DPCode.DEHUMIDITY_SET_VALUE,
|
humidity=DPCode.DEHUMIDITY_SET_VALUE,
|
||||||
device_class=DEVICE_CLASS_DEHUMIDIFIER,
|
device_class=HumidifierDeviceClass.DEHUMIDIFIER,
|
||||||
),
|
),
|
||||||
# Humidifier
|
# Humidifier
|
||||||
# https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b
|
# https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b
|
||||||
|
@ -47,7 +46,7 @@ HUMIDIFIERS: dict[str, TuyaHumidifierEntityDescription] = {
|
||||||
key=DPCode.SWITCH,
|
key=DPCode.SWITCH,
|
||||||
dpcode=(DPCode.SWITCH, DPCode.SWITCH_SPRAY),
|
dpcode=(DPCode.SWITCH, DPCode.SWITCH_SPRAY),
|
||||||
humidity=DPCode.HUMIDITY_SET,
|
humidity=DPCode.HUMIDITY_SET,
|
||||||
device_class=DEVICE_CLASS_HUMIDIFIER,
|
device_class=HumidifierDeviceClass.HUMIDIFIER,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ from tuya_iot.device import TuyaDeviceStatusRange
|
||||||
|
|
||||||
from homeassistant.components.number import NumberEntity, NumberEntityDescription
|
from homeassistant.components.number import NumberEntity, NumberEntityDescription
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ENTITY_CATEGORY_CONFIG
|
|
||||||
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 import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import HomeAssistantTuyaData
|
from . import HomeAssistantTuyaData
|
||||||
|
@ -28,31 +28,31 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
key=DPCode.TEMP_SET,
|
key=DPCode.TEMP_SET,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.TEMP_SET_F,
|
key=DPCode.TEMP_SET_F,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.TEMP_BOILING_C,
|
key=DPCode.TEMP_BOILING_C,
|
||||||
name="Temperature After Boiling",
|
name="Temperature After Boiling",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.TEMP_BOILING_F,
|
key=DPCode.TEMP_BOILING_F,
|
||||||
name="Temperature After Boiling",
|
name="Temperature After Boiling",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.WARM_TIME,
|
key=DPCode.WARM_TIME,
|
||||||
name="Heat Preservation Time",
|
name="Heat Preservation Time",
|
||||||
icon="mdi:timer",
|
icon="mdi:timer",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Human Presence Sensor
|
# Human Presence Sensor
|
||||||
|
@ -61,19 +61,19 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.SENSITIVITY,
|
key=DPCode.SENSITIVITY,
|
||||||
name="Sensitivity",
|
name="Sensitivity",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.NEAR_DETECTION,
|
key=DPCode.NEAR_DETECTION,
|
||||||
name="Near Detection",
|
name="Near Detection",
|
||||||
icon="mdi:signal-distance-variant",
|
icon="mdi:signal-distance-variant",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.FAR_DETECTION,
|
key=DPCode.FAR_DETECTION,
|
||||||
name="Far Detection",
|
name="Far Detection",
|
||||||
icon="mdi:signal-distance-variant",
|
icon="mdi:signal-distance-variant",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Coffee maker
|
# Coffee maker
|
||||||
|
@ -83,24 +83,24 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
key=DPCode.WATER_SET,
|
key=DPCode.WATER_SET,
|
||||||
name="Water Level",
|
name="Water Level",
|
||||||
icon="mdi:cup-water",
|
icon="mdi:cup-water",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.TEMP_SET,
|
key=DPCode.TEMP_SET,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.WARM_TIME,
|
key=DPCode.WARM_TIME,
|
||||||
name="Heat Preservation Time",
|
name="Heat Preservation Time",
|
||||||
icon="mdi:timer",
|
icon="mdi:timer",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.POWDER_SET,
|
key=DPCode.POWDER_SET,
|
||||||
name="Powder",
|
name="Powder",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Robot Vacuum
|
# Robot Vacuum
|
||||||
|
@ -110,7 +110,7 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
key=DPCode.VOLUME_SET,
|
key=DPCode.VOLUME_SET,
|
||||||
name="Volume",
|
name="Volume",
|
||||||
icon="mdi:volume-high",
|
icon="mdi:volume-high",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Siren Alarm
|
# Siren Alarm
|
||||||
|
@ -119,7 +119,7 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.ALARM_TIME,
|
key=DPCode.ALARM_TIME,
|
||||||
name="Time",
|
name="Time",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Smart Camera
|
# Smart Camera
|
||||||
|
@ -129,7 +129,7 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
key=DPCode.BASIC_DEVICE_VOLUME,
|
key=DPCode.BASIC_DEVICE_VOLUME,
|
||||||
name="Volume",
|
name="Volume",
|
||||||
icon="mdi:volume-high",
|
icon="mdi:volume-high",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Dimmer Switch
|
# Dimmer Switch
|
||||||
|
@ -139,37 +139,37 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
key=DPCode.BRIGHTNESS_MIN_1,
|
key=DPCode.BRIGHTNESS_MIN_1,
|
||||||
name="Minimum Brightness",
|
name="Minimum Brightness",
|
||||||
icon="mdi:lightbulb-outline",
|
icon="mdi:lightbulb-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.BRIGHTNESS_MAX_1,
|
key=DPCode.BRIGHTNESS_MAX_1,
|
||||||
name="Maximum Brightness",
|
name="Maximum Brightness",
|
||||||
icon="mdi:lightbulb-on-outline",
|
icon="mdi:lightbulb-on-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.BRIGHTNESS_MIN_2,
|
key=DPCode.BRIGHTNESS_MIN_2,
|
||||||
name="Minimum Brightness 2",
|
name="Minimum Brightness 2",
|
||||||
icon="mdi:lightbulb-outline",
|
icon="mdi:lightbulb-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.BRIGHTNESS_MAX_2,
|
key=DPCode.BRIGHTNESS_MAX_2,
|
||||||
name="Maximum Brightness 2",
|
name="Maximum Brightness 2",
|
||||||
icon="mdi:lightbulb-on-outline",
|
icon="mdi:lightbulb-on-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.BRIGHTNESS_MIN_3,
|
key=DPCode.BRIGHTNESS_MIN_3,
|
||||||
name="Minimum Brightness 3",
|
name="Minimum Brightness 3",
|
||||||
icon="mdi:lightbulb-outline",
|
icon="mdi:lightbulb-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.BRIGHTNESS_MAX_3,
|
key=DPCode.BRIGHTNESS_MAX_3,
|
||||||
name="Maximum Brightness 3",
|
name="Maximum Brightness 3",
|
||||||
icon="mdi:lightbulb-on-outline",
|
icon="mdi:lightbulb-on-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Dimmer Switch
|
# Dimmer Switch
|
||||||
|
@ -179,25 +179,25 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
key=DPCode.BRIGHTNESS_MIN_1,
|
key=DPCode.BRIGHTNESS_MIN_1,
|
||||||
name="Minimum Brightness",
|
name="Minimum Brightness",
|
||||||
icon="mdi:lightbulb-outline",
|
icon="mdi:lightbulb-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.BRIGHTNESS_MAX_1,
|
key=DPCode.BRIGHTNESS_MAX_1,
|
||||||
name="Maximum Brightness",
|
name="Maximum Brightness",
|
||||||
icon="mdi:lightbulb-on-outline",
|
icon="mdi:lightbulb-on-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.BRIGHTNESS_MIN_2,
|
key=DPCode.BRIGHTNESS_MIN_2,
|
||||||
name="Minimum Brightness 2",
|
name="Minimum Brightness 2",
|
||||||
icon="mdi:lightbulb-outline",
|
icon="mdi:lightbulb-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.BRIGHTNESS_MAX_2,
|
key=DPCode.BRIGHTNESS_MAX_2,
|
||||||
name="Maximum Brightness 2",
|
name="Maximum Brightness 2",
|
||||||
icon="mdi:lightbulb-on-outline",
|
icon="mdi:lightbulb-on-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Vibration Sensor
|
# Vibration Sensor
|
||||||
|
@ -206,7 +206,7 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.SENSITIVITY,
|
key=DPCode.SENSITIVITY,
|
||||||
name="Sensitivity",
|
name="Sensitivity",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Fingerbot
|
# Fingerbot
|
||||||
|
@ -215,19 +215,19 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
key=DPCode.ARM_DOWN_PERCENT,
|
key=DPCode.ARM_DOWN_PERCENT,
|
||||||
name="Move Down %",
|
name="Move Down %",
|
||||||
icon="mdi:arrow-down-bold",
|
icon="mdi:arrow-down-bold",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.ARM_UP_PERCENT,
|
key=DPCode.ARM_UP_PERCENT,
|
||||||
name="Move Up %",
|
name="Move Up %",
|
||||||
icon="mdi:arrow-up-bold",
|
icon="mdi:arrow-up-bold",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key=DPCode.CLICK_SUSTAIN_TIME,
|
key=DPCode.CLICK_SUSTAIN_TIME,
|
||||||
name="Down Delay",
|
name="Down Delay",
|
||||||
icon="mdi:timer",
|
icon="mdi:timer",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ from tuya_iot.device import TuyaDeviceStatusRange
|
||||||
|
|
||||||
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ENTITY_CATEGORY_CONFIG
|
|
||||||
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 import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import HomeAssistantTuyaData
|
from . import HomeAssistantTuyaData
|
||||||
|
@ -47,12 +47,12 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
|
||||||
key=DPCode.CONCENTRATION_SET,
|
key=DPCode.CONCENTRATION_SET,
|
||||||
name="Concentration",
|
name="Concentration",
|
||||||
icon="mdi:altimeter",
|
icon="mdi:altimeter",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.MATERIAL,
|
key=DPCode.MATERIAL,
|
||||||
name="Material",
|
name="Material",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.MODE,
|
key=DPCode.MODE,
|
||||||
|
@ -67,13 +67,13 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
|
||||||
key=DPCode.RELAY_STATUS,
|
key=DPCode.RELAY_STATUS,
|
||||||
name="Power on Behavior",
|
name="Power on Behavior",
|
||||||
device_class=DEVICE_CLASS_TUYA_RELAY_STATUS,
|
device_class=DEVICE_CLASS_TUYA_RELAY_STATUS,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.LIGHT_MODE,
|
key=DPCode.LIGHT_MODE,
|
||||||
name="Indicator Light Mode",
|
name="Indicator Light Mode",
|
||||||
device_class=DEVICE_CLASS_TUYA_LIGHT_MODE,
|
device_class=DEVICE_CLASS_TUYA_LIGHT_MODE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Heater
|
# Heater
|
||||||
|
@ -91,12 +91,12 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.ALARM_VOLUME,
|
key=DPCode.ALARM_VOLUME,
|
||||||
name="Volume",
|
name="Volume",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.BRIGHT_STATE,
|
key=DPCode.BRIGHT_STATE,
|
||||||
name="Brightness",
|
name="Brightness",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Smart Camera
|
# Smart Camera
|
||||||
|
@ -106,42 +106,42 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
|
||||||
key=DPCode.IPC_WORK_MODE,
|
key=DPCode.IPC_WORK_MODE,
|
||||||
name="IPC Mode",
|
name="IPC Mode",
|
||||||
device_class=DEVICE_CLASS_TUYA_IPC_WORK_MODE,
|
device_class=DEVICE_CLASS_TUYA_IPC_WORK_MODE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.DECIBEL_SENSITIVITY,
|
key=DPCode.DECIBEL_SENSITIVITY,
|
||||||
name="Sound Detection Sensitivity",
|
name="Sound Detection Sensitivity",
|
||||||
icon="mdi:volume-vibrate",
|
icon="mdi:volume-vibrate",
|
||||||
device_class=DEVICE_CLASS_TUYA_DECIBEL_SENSITIVITY,
|
device_class=DEVICE_CLASS_TUYA_DECIBEL_SENSITIVITY,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.RECORD_MODE,
|
key=DPCode.RECORD_MODE,
|
||||||
name="Record Mode",
|
name="Record Mode",
|
||||||
icon="mdi:record-rec",
|
icon="mdi:record-rec",
|
||||||
device_class=DEVICE_CLASS_TUYA_RECORD_MODE,
|
device_class=DEVICE_CLASS_TUYA_RECORD_MODE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.BASIC_NIGHTVISION,
|
key=DPCode.BASIC_NIGHTVISION,
|
||||||
name="Night Vision",
|
name="Night Vision",
|
||||||
icon="mdi:theme-light-dark",
|
icon="mdi:theme-light-dark",
|
||||||
device_class=DEVICE_CLASS_TUYA_BASIC_NIGHTVISION,
|
device_class=DEVICE_CLASS_TUYA_BASIC_NIGHTVISION,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.BASIC_ANTI_FLICKER,
|
key=DPCode.BASIC_ANTI_FLICKER,
|
||||||
name="Anti-flicker",
|
name="Anti-flicker",
|
||||||
icon="mdi:image-outline",
|
icon="mdi:image-outline",
|
||||||
device_class=DEVICE_CLASS_TUYA_BASIC_ANTI_FLICKR,
|
device_class=DEVICE_CLASS_TUYA_BASIC_ANTI_FLICKR,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.MOTION_SENSITIVITY,
|
key=DPCode.MOTION_SENSITIVITY,
|
||||||
name="Motion Detection Sensitivity",
|
name="Motion Detection Sensitivity",
|
||||||
icon="mdi:motion-sensor",
|
icon="mdi:motion-sensor",
|
||||||
device_class=DEVICE_CLASS_TUYA_MOTION_SENSITIVITY,
|
device_class=DEVICE_CLASS_TUYA_MOTION_SENSITIVITY,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# IoT Switch?
|
# IoT Switch?
|
||||||
|
@ -151,13 +151,13 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
|
||||||
key=DPCode.RELAY_STATUS,
|
key=DPCode.RELAY_STATUS,
|
||||||
name="Power on Behavior",
|
name="Power on Behavior",
|
||||||
device_class=DEVICE_CLASS_TUYA_RELAY_STATUS,
|
device_class=DEVICE_CLASS_TUYA_RELAY_STATUS,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.LIGHT_MODE,
|
key=DPCode.LIGHT_MODE,
|
||||||
name="Indicator Light Mode",
|
name="Indicator Light Mode",
|
||||||
device_class=DEVICE_CLASS_TUYA_LIGHT_MODE,
|
device_class=DEVICE_CLASS_TUYA_LIGHT_MODE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Dimmer Switch
|
# Dimmer Switch
|
||||||
|
@ -167,31 +167,31 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
|
||||||
key=DPCode.RELAY_STATUS,
|
key=DPCode.RELAY_STATUS,
|
||||||
name="Power on Behavior",
|
name="Power on Behavior",
|
||||||
device_class=DEVICE_CLASS_TUYA_RELAY_STATUS,
|
device_class=DEVICE_CLASS_TUYA_RELAY_STATUS,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.LIGHT_MODE,
|
key=DPCode.LIGHT_MODE,
|
||||||
name="Indicator Light Mode",
|
name="Indicator Light Mode",
|
||||||
device_class=DEVICE_CLASS_TUYA_LIGHT_MODE,
|
device_class=DEVICE_CLASS_TUYA_LIGHT_MODE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.LED_TYPE_1,
|
key=DPCode.LED_TYPE_1,
|
||||||
name="Light Source Type",
|
name="Light Source Type",
|
||||||
device_class=DEVICE_CLASS_TUYA_LED_TYPE,
|
device_class=DEVICE_CLASS_TUYA_LED_TYPE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.LED_TYPE_2,
|
key=DPCode.LED_TYPE_2,
|
||||||
name="Light 2 Source Type",
|
name="Light 2 Source Type",
|
||||||
device_class=DEVICE_CLASS_TUYA_LED_TYPE,
|
device_class=DEVICE_CLASS_TUYA_LED_TYPE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.LED_TYPE_3,
|
key=DPCode.LED_TYPE_3,
|
||||||
name="Light 3 Source Type",
|
name="Light 3 Source Type",
|
||||||
device_class=DEVICE_CLASS_TUYA_LED_TYPE,
|
device_class=DEVICE_CLASS_TUYA_LED_TYPE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Dimmer
|
# Dimmer
|
||||||
|
@ -201,13 +201,13 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
|
||||||
key=DPCode.LED_TYPE_1,
|
key=DPCode.LED_TYPE_1,
|
||||||
name="Light Source Type",
|
name="Light Source Type",
|
||||||
device_class=DEVICE_CLASS_TUYA_LED_TYPE,
|
device_class=DEVICE_CLASS_TUYA_LED_TYPE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key=DPCode.LED_TYPE_2,
|
key=DPCode.LED_TYPE_2,
|
||||||
name="Light 2 Source Type",
|
name="Light 2 Source Type",
|
||||||
device_class=DEVICE_CLASS_TUYA_LED_TYPE,
|
device_class=DEVICE_CLASS_TUYA_LED_TYPE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Fingerbot
|
# Fingerbot
|
||||||
|
@ -216,7 +216,7 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
|
||||||
key=DPCode.MODE,
|
key=DPCode.MODE,
|
||||||
name="Mode",
|
name="Mode",
|
||||||
device_class=DEVICE_CLASS_TUYA_FINGERBOT_MODE,
|
device_class=DEVICE_CLASS_TUYA_FINGERBOT_MODE,
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,36 +8,21 @@ from tuya_iot import TuyaDevice, TuyaDeviceManager
|
||||||
from tuya_iot.device import TuyaDeviceStatusRange
|
from tuya_iot.device import TuyaDeviceStatusRange
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
DEVICE_CLASS_BATTERY,
|
SensorDeviceClass,
|
||||||
STATE_CLASS_MEASUREMENT,
|
|
||||||
STATE_CLASS_TOTAL_INCREASING,
|
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
DEVICE_CLASS_CO,
|
|
||||||
DEVICE_CLASS_CO2,
|
|
||||||
DEVICE_CLASS_CURRENT,
|
|
||||||
DEVICE_CLASS_ENERGY,
|
|
||||||
DEVICE_CLASS_HUMIDITY,
|
|
||||||
DEVICE_CLASS_ILLUMINANCE,
|
|
||||||
DEVICE_CLASS_PM1,
|
|
||||||
DEVICE_CLASS_PM10,
|
|
||||||
DEVICE_CLASS_PM25,
|
|
||||||
DEVICE_CLASS_POWER,
|
|
||||||
DEVICE_CLASS_PRESSURE,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
|
||||||
DEVICE_CLASS_VOLTAGE,
|
|
||||||
ELECTRIC_CURRENT_AMPERE,
|
ELECTRIC_CURRENT_AMPERE,
|
||||||
ELECTRIC_POTENTIAL_VOLT,
|
ELECTRIC_POTENTIAL_VOLT,
|
||||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_KILO_WATT,
|
POWER_KILO_WATT,
|
||||||
)
|
)
|
||||||
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 import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
|
|
||||||
|
@ -66,29 +51,29 @@ BATTERY_SENSORS: tuple[TuyaSensorEntityDescription, ...] = (
|
||||||
key=DPCode.BATTERY_PERCENTAGE,
|
key=DPCode.BATTERY_PERCENTAGE,
|
||||||
name="Battery",
|
name="Battery",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
device_class=DEVICE_CLASS_BATTERY,
|
device_class=SensorDeviceClass.BATTERY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.BATTERY_STATE,
|
key=DPCode.BATTERY_STATE,
|
||||||
name="Battery State",
|
name="Battery State",
|
||||||
icon="mdi:battery",
|
icon="mdi:battery",
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.BATTERY_VALUE,
|
key=DPCode.BATTERY_VALUE,
|
||||||
name="Battery",
|
name="Battery",
|
||||||
device_class=DEVICE_CLASS_BATTERY,
|
device_class=SensorDeviceClass.BATTERY,
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.VA_BATTERY,
|
key=DPCode.VA_BATTERY,
|
||||||
name="Battery",
|
name="Battery",
|
||||||
device_class=DEVICE_CLASS_BATTERY,
|
device_class=SensorDeviceClass.BATTERY,
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -103,14 +88,14 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.TEMP_CURRENT,
|
key=DPCode.TEMP_CURRENT,
|
||||||
name="Current Temperature",
|
name="Current Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.TEMP_CURRENT_F,
|
key=DPCode.TEMP_CURRENT_F,
|
||||||
name="Current Temperature",
|
name="Current Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.STATUS,
|
key=DPCode.STATUS,
|
||||||
|
@ -124,20 +109,20 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.HUMIDITY_VALUE,
|
key=DPCode.HUMIDITY_VALUE,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.TEMP_CURRENT,
|
key=DPCode.TEMP_CURRENT,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CO2_VALUE,
|
key=DPCode.CO2_VALUE,
|
||||||
name="Carbon Dioxide",
|
name="Carbon Dioxide",
|
||||||
device_class=DEVICE_CLASS_CO2,
|
device_class=SensorDeviceClass.CO2,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -147,8 +132,8 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CO_VALUE,
|
key=DPCode.CO_VALUE,
|
||||||
name="Carbon Monoxide",
|
name="Carbon Monoxide",
|
||||||
device_class=DEVICE_CLASS_CO,
|
device_class=SensorDeviceClass.CO,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -158,37 +143,37 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.TEMP_CURRENT,
|
key=DPCode.TEMP_CURRENT,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.HUMIDITY_VALUE,
|
key=DPCode.HUMIDITY_VALUE,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CO2_VALUE,
|
key=DPCode.CO2_VALUE,
|
||||||
name="Carbon Dioxide",
|
name="Carbon Dioxide",
|
||||||
device_class=DEVICE_CLASS_CO2,
|
device_class=SensorDeviceClass.CO2,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CH2O_VALUE,
|
key=DPCode.CH2O_VALUE,
|
||||||
name="Formaldehyde",
|
name="Formaldehyde",
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.VOC_VALUE,
|
key=DPCode.VOC_VALUE,
|
||||||
name="Volatile Organic Compound",
|
name="Volatile Organic Compound",
|
||||||
device_class=DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PM25_VALUE,
|
key=DPCode.PM25_VALUE,
|
||||||
name="Particulate Matter 2.5 µm",
|
name="Particulate Matter 2.5 µm",
|
||||||
device_class=DEVICE_CLASS_PM25,
|
device_class=SensorDeviceClass.PM25,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Formaldehyde Detector
|
# Formaldehyde Detector
|
||||||
|
@ -197,37 +182,37 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CO2_VALUE,
|
key=DPCode.CO2_VALUE,
|
||||||
name="Carbon Dioxide",
|
name="Carbon Dioxide",
|
||||||
device_class=DEVICE_CLASS_CO2,
|
device_class=SensorDeviceClass.CO2,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.VOC_VALUE,
|
key=DPCode.VOC_VALUE,
|
||||||
name="Volatile Organic Compound",
|
name="Volatile Organic Compound",
|
||||||
device_class=DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PM25_VALUE,
|
key=DPCode.PM25_VALUE,
|
||||||
name="Particulate Matter 2.5 µm",
|
name="Particulate Matter 2.5 µm",
|
||||||
device_class=DEVICE_CLASS_PM25,
|
device_class=SensorDeviceClass.PM25,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.VA_HUMIDITY,
|
key=DPCode.VA_HUMIDITY,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.VA_TEMPERATURE,
|
key=DPCode.VA_TEMPERATURE,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CH2O_VALUE,
|
key=DPCode.CH2O_VALUE,
|
||||||
name="Formaldehyde",
|
name="Formaldehyde",
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -237,7 +222,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CH4_SENSOR_VALUE,
|
key=DPCode.CH4_SENSOR_VALUE,
|
||||||
name="Methane",
|
name="Methane",
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -247,22 +232,22 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CUR_CURRENT,
|
key=DPCode.CUR_CURRENT,
|
||||||
name="Current",
|
name="Current",
|
||||||
device_class=DEVICE_CLASS_CURRENT,
|
device_class=SensorDeviceClass.CURRENT,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CUR_POWER,
|
key=DPCode.CUR_POWER,
|
||||||
name="Power",
|
name="Power",
|
||||||
device_class=DEVICE_CLASS_POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CUR_VOLTAGE,
|
key=DPCode.CUR_VOLTAGE,
|
||||||
name="Voltage",
|
name="Voltage",
|
||||||
device_class=DEVICE_CLASS_VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -277,26 +262,26 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.BRIGHT_VALUE,
|
key=DPCode.BRIGHT_VALUE,
|
||||||
name="Luminosity",
|
name="Luminosity",
|
||||||
device_class=DEVICE_CLASS_ILLUMINANCE,
|
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.TEMP_CURRENT,
|
key=DPCode.TEMP_CURRENT,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.HUMIDITY_VALUE,
|
key=DPCode.HUMIDITY_VALUE,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CO2_VALUE,
|
key=DPCode.CO2_VALUE,
|
||||||
name="Carbon Dioxide",
|
name="Carbon Dioxide",
|
||||||
device_class=DEVICE_CLASS_CO2,
|
device_class=SensorDeviceClass.CO2,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -312,49 +297,49 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PM25_VALUE,
|
key=DPCode.PM25_VALUE,
|
||||||
name="Particulate Matter 2.5 µm",
|
name="Particulate Matter 2.5 µm",
|
||||||
device_class=DEVICE_CLASS_PM25,
|
device_class=SensorDeviceClass.PM25,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CH2O_VALUE,
|
key=DPCode.CH2O_VALUE,
|
||||||
name="Formaldehyde",
|
name="Formaldehyde",
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.VOC_VALUE,
|
key=DPCode.VOC_VALUE,
|
||||||
name="Volatile Organic Compound",
|
name="Volatile Organic Compound",
|
||||||
device_class=DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.TEMP_CURRENT,
|
key=DPCode.TEMP_CURRENT,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CO2_VALUE,
|
key=DPCode.CO2_VALUE,
|
||||||
name="Carbon Dioxide",
|
name="Carbon Dioxide",
|
||||||
device_class=DEVICE_CLASS_CO2,
|
device_class=SensorDeviceClass.CO2,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.HUMIDITY_VALUE,
|
key=DPCode.HUMIDITY_VALUE,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PM1,
|
key=DPCode.PM1,
|
||||||
name="Particulate Matter 1.0 µm",
|
name="Particulate Matter 1.0 µm",
|
||||||
device_class=DEVICE_CLASS_PM1,
|
device_class=SensorDeviceClass.PM1,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PM10,
|
key=DPCode.PM10,
|
||||||
name="Particulate Matter 10.0 µm",
|
name="Particulate Matter 10.0 µm",
|
||||||
device_class=DEVICE_CLASS_PM10,
|
device_class=SensorDeviceClass.PM10,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -364,8 +349,8 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.WORK_POWER,
|
key=DPCode.WORK_POWER,
|
||||||
name="Power",
|
name="Power",
|
||||||
device_class=DEVICE_CLASS_POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Gas Detector
|
# Gas Detector
|
||||||
|
@ -374,7 +359,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.GAS_SENSOR_VALUE,
|
key=DPCode.GAS_SENSOR_VALUE,
|
||||||
icon="mdi:gas-cylinder",
|
icon="mdi:gas-cylinder",
|
||||||
device_class=STATE_CLASS_MEASUREMENT,
|
device_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -390,21 +375,21 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.SENSOR_TEMPERATURE,
|
key=DPCode.SENSOR_TEMPERATURE,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.SENSOR_HUMIDITY,
|
key=DPCode.SENSOR_HUMIDITY,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.WIRELESS_ELECTRICITY,
|
key=DPCode.WIRELESS_ELECTRICITY,
|
||||||
name="Battery",
|
name="Battery",
|
||||||
device_class=DEVICE_CLASS_BATTERY,
|
device_class=SensorDeviceClass.BATTERY,
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Fingerbot
|
# Fingerbot
|
||||||
|
@ -418,37 +403,37 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CO2_VALUE,
|
key=DPCode.CO2_VALUE,
|
||||||
name="Carbon Dioxide",
|
name="Carbon Dioxide",
|
||||||
device_class=DEVICE_CLASS_CO2,
|
device_class=SensorDeviceClass.CO2,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PM25_VALUE,
|
key=DPCode.PM25_VALUE,
|
||||||
name="Particulate Matter 2.5 µm",
|
name="Particulate Matter 2.5 µm",
|
||||||
device_class=DEVICE_CLASS_PM25,
|
device_class=SensorDeviceClass.PM25,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.CH2O_VALUE,
|
key=DPCode.CH2O_VALUE,
|
||||||
name="Formaldehyde",
|
name="Formaldehyde",
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.HUMIDITY_VALUE,
|
key=DPCode.HUMIDITY_VALUE,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.TEMP_CURRENT,
|
key=DPCode.TEMP_CURRENT,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.VOC_VALUE,
|
key=DPCode.VOC_VALUE,
|
||||||
name="Volatile Organic Compound",
|
name="Volatile Organic Compound",
|
||||||
device_class=DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -458,32 +443,32 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.VA_TEMPERATURE,
|
key=DPCode.VA_TEMPERATURE,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.TEMP_CURRENT,
|
key=DPCode.TEMP_CURRENT,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.VA_HUMIDITY,
|
key=DPCode.VA_HUMIDITY,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.HUMIDITY_VALUE,
|
key=DPCode.HUMIDITY_VALUE,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.BRIGHT_VALUE,
|
key=DPCode.BRIGHT_VALUE,
|
||||||
name="Luminosity",
|
name="Luminosity",
|
||||||
device_class=DEVICE_CLASS_ILLUMINANCE,
|
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -492,8 +477,8 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
"ylcg": (
|
"ylcg": (
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PRESSURE_VALUE,
|
key=DPCode.PRESSURE_VALUE,
|
||||||
device_class=DEVICE_CLASS_PRESSURE,
|
device_class=SensorDeviceClass.PRESSURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -504,8 +489,8 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
key=DPCode.SMOKE_SENSOR_VALUE,
|
key=DPCode.SMOKE_SENSOR_VALUE,
|
||||||
name="Smoke Amount",
|
name="Smoke Amount",
|
||||||
icon="mdi:smoke-detector",
|
icon="mdi:smoke-detector",
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
device_class=STATE_CLASS_MEASUREMENT,
|
device_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
*BATTERY_SENSORS,
|
*BATTERY_SENSORS,
|
||||||
),
|
),
|
||||||
|
@ -518,78 +503,78 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.FORWARD_ENERGY_TOTAL,
|
key=DPCode.FORWARD_ENERGY_TOTAL,
|
||||||
name="Total Energy",
|
name="Total Energy",
|
||||||
device_class=DEVICE_CLASS_ENERGY,
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PHASE_A,
|
key=DPCode.PHASE_A,
|
||||||
name="Phase A Current",
|
name="Phase A Current",
|
||||||
device_class=DEVICE_CLASS_CURRENT,
|
device_class=SensorDeviceClass.CURRENT,
|
||||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
subkey="electriccurrent",
|
subkey="electriccurrent",
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PHASE_A,
|
key=DPCode.PHASE_A,
|
||||||
name="Phase A Power",
|
name="Phase A Power",
|
||||||
device_class=DEVICE_CLASS_POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_KILO_WATT,
|
native_unit_of_measurement=POWER_KILO_WATT,
|
||||||
subkey="power",
|
subkey="power",
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PHASE_A,
|
key=DPCode.PHASE_A,
|
||||||
name="Phase A Voltage",
|
name="Phase A Voltage",
|
||||||
device_class=DEVICE_CLASS_VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
||||||
subkey="voltage",
|
subkey="voltage",
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PHASE_B,
|
key=DPCode.PHASE_B,
|
||||||
name="Phase B Current",
|
name="Phase B Current",
|
||||||
device_class=DEVICE_CLASS_CURRENT,
|
device_class=SensorDeviceClass.CURRENT,
|
||||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
subkey="electriccurrent",
|
subkey="electriccurrent",
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PHASE_B,
|
key=DPCode.PHASE_B,
|
||||||
name="Phase B Power",
|
name="Phase B Power",
|
||||||
device_class=DEVICE_CLASS_POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_KILO_WATT,
|
native_unit_of_measurement=POWER_KILO_WATT,
|
||||||
subkey="power",
|
subkey="power",
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PHASE_B,
|
key=DPCode.PHASE_B,
|
||||||
name="Phase B Voltage",
|
name="Phase B Voltage",
|
||||||
device_class=DEVICE_CLASS_VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
||||||
subkey="voltage",
|
subkey="voltage",
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PHASE_C,
|
key=DPCode.PHASE_C,
|
||||||
name="Phase C Current",
|
name="Phase C Current",
|
||||||
device_class=DEVICE_CLASS_CURRENT,
|
device_class=SensorDeviceClass.CURRENT,
|
||||||
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
subkey="electriccurrent",
|
subkey="electriccurrent",
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PHASE_C,
|
key=DPCode.PHASE_C,
|
||||||
name="Phase C Power",
|
name="Phase C Power",
|
||||||
device_class=DEVICE_CLASS_POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_KILO_WATT,
|
native_unit_of_measurement=POWER_KILO_WATT,
|
||||||
subkey="power",
|
subkey="power",
|
||||||
),
|
),
|
||||||
TuyaSensorEntityDescription(
|
TuyaSensorEntityDescription(
|
||||||
key=DPCode.PHASE_C,
|
key=DPCode.PHASE_C,
|
||||||
name="Phase C Voltage",
|
name="Phase C Voltage",
|
||||||
device_class=DEVICE_CLASS_VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
||||||
subkey="voltage",
|
subkey="voltage",
|
||||||
),
|
),
|
||||||
|
|
|
@ -6,14 +6,14 @@ from typing import Any
|
||||||
from tuya_iot import TuyaDevice, TuyaDeviceManager
|
from tuya_iot import TuyaDevice, TuyaDeviceManager
|
||||||
|
|
||||||
from homeassistant.components.switch import (
|
from homeassistant.components.switch import (
|
||||||
DEVICE_CLASS_OUTLET,
|
SwitchDeviceClass,
|
||||||
SwitchEntity,
|
SwitchEntity,
|
||||||
SwitchEntityDescription,
|
SwitchEntityDescription,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ENTITY_CATEGORY_CONFIG
|
|
||||||
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 import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import HomeAssistantTuyaData
|
from . import HomeAssistantTuyaData
|
||||||
|
@ -35,7 +35,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.WARM,
|
key=DPCode.WARM,
|
||||||
name="Heat Preservation",
|
name="Heat Preservation",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Pet Water Feeder
|
# Pet Water Feeder
|
||||||
|
@ -45,13 +45,13 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.FILTER_RESET,
|
key=DPCode.FILTER_RESET,
|
||||||
name="Filter reset",
|
name="Filter reset",
|
||||||
icon="mdi:filter",
|
icon="mdi:filter",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.PUMP_RESET,
|
key=DPCode.PUMP_RESET,
|
||||||
name="Water pump reset",
|
name="Water pump reset",
|
||||||
icon="mdi:pump",
|
icon="mdi:pump",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH,
|
key=DPCode.SWITCH,
|
||||||
|
@ -61,7 +61,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.WATER_RESET,
|
key=DPCode.WATER_RESET,
|
||||||
name="Reset of water usage days",
|
name="Reset of water usage days",
|
||||||
icon="mdi:water-sync",
|
icon="mdi:water-sync",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Light
|
# Light
|
||||||
|
@ -81,7 +81,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.CHILD_LOCK,
|
key=DPCode.CHILD_LOCK,
|
||||||
name="Child Lock",
|
name="Child Lock",
|
||||||
icon="mdi:account-lock",
|
icon="mdi:account-lock",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_1,
|
key=DPCode.SWITCH_1,
|
||||||
|
@ -95,37 +95,37 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.CHILD_LOCK,
|
key=DPCode.CHILD_LOCK,
|
||||||
name="Child Lock",
|
name="Child Lock",
|
||||||
icon="mdi:account-lock",
|
icon="mdi:account-lock",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_1,
|
key=DPCode.SWITCH_1,
|
||||||
name="Switch 1",
|
name="Switch 1",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_2,
|
key=DPCode.SWITCH_2,
|
||||||
name="Switch 2",
|
name="Switch 2",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_3,
|
key=DPCode.SWITCH_3,
|
||||||
name="Switch 3",
|
name="Switch 3",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_4,
|
key=DPCode.SWITCH_4,
|
||||||
name="Switch 4",
|
name="Switch 4",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_5,
|
key=DPCode.SWITCH_5,
|
||||||
name="Switch 5",
|
name="Switch 5",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_6,
|
key=DPCode.SWITCH_6,
|
||||||
name="Switch 6",
|
name="Switch 6",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_USB1,
|
key=DPCode.SWITCH_USB1,
|
||||||
|
@ -154,7 +154,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH,
|
key=DPCode.SWITCH,
|
||||||
name="Switch",
|
name="Switch",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Air Purifier
|
# Air Purifier
|
||||||
|
@ -164,19 +164,19 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.ANION,
|
key=DPCode.ANION,
|
||||||
name="Ionizer",
|
name="Ionizer",
|
||||||
icon="mdi:minus-circle-outline",
|
icon="mdi:minus-circle-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.FILTER_RESET,
|
key=DPCode.FILTER_RESET,
|
||||||
name="Filter cartridge reset",
|
name="Filter cartridge reset",
|
||||||
icon="mdi:filter",
|
icon="mdi:filter",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.LOCK,
|
key=DPCode.LOCK,
|
||||||
name="Child lock",
|
name="Child lock",
|
||||||
icon="mdi:account-lock",
|
icon="mdi:account-lock",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH,
|
key=DPCode.SWITCH,
|
||||||
|
@ -186,7 +186,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.WET,
|
key=DPCode.WET,
|
||||||
name="Humidification",
|
name="Humidification",
|
||||||
icon="mdi:water-percent",
|
icon="mdi:water-percent",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Air conditioner
|
# Air conditioner
|
||||||
|
@ -196,13 +196,13 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.ANION,
|
key=DPCode.ANION,
|
||||||
name="Ionizer",
|
name="Ionizer",
|
||||||
icon="mdi:minus-circle-outline",
|
icon="mdi:minus-circle-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.LOCK,
|
key=DPCode.LOCK,
|
||||||
name="Child Lock",
|
name="Child Lock",
|
||||||
icon="mdi:account-lock",
|
icon="mdi:account-lock",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Power Socket
|
# Power Socket
|
||||||
|
@ -212,37 +212,37 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.CHILD_LOCK,
|
key=DPCode.CHILD_LOCK,
|
||||||
name="Child Lock",
|
name="Child Lock",
|
||||||
icon="mdi:account-lock",
|
icon="mdi:account-lock",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_1,
|
key=DPCode.SWITCH_1,
|
||||||
name="Socket 1",
|
name="Socket 1",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_2,
|
key=DPCode.SWITCH_2,
|
||||||
name="Socket 2",
|
name="Socket 2",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_3,
|
key=DPCode.SWITCH_3,
|
||||||
name="Socket 3",
|
name="Socket 3",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_4,
|
key=DPCode.SWITCH_4,
|
||||||
name="Socket 4",
|
name="Socket 4",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_5,
|
key=DPCode.SWITCH_5,
|
||||||
name="Socket 5",
|
name="Socket 5",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_6,
|
key=DPCode.SWITCH_6,
|
||||||
name="Socket 6",
|
name="Socket 6",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_USB1,
|
key=DPCode.SWITCH_USB1,
|
||||||
|
@ -271,7 +271,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH,
|
key=DPCode.SWITCH,
|
||||||
name="Socket",
|
name="Socket",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Heater
|
# Heater
|
||||||
|
@ -281,13 +281,13 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.ANION,
|
key=DPCode.ANION,
|
||||||
name="Ionizer",
|
name="Ionizer",
|
||||||
icon="mdi:minus-circle-outline",
|
icon="mdi:minus-circle-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.LOCK,
|
key=DPCode.LOCK,
|
||||||
name="Child Lock",
|
name="Child Lock",
|
||||||
icon="mdi:account-lock",
|
icon="mdi:account-lock",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Robot Vacuum
|
# Robot Vacuum
|
||||||
|
@ -297,13 +297,13 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.SWITCH_DISTURB,
|
key=DPCode.SWITCH_DISTURB,
|
||||||
name="Do Not Disturb",
|
name="Do Not Disturb",
|
||||||
icon="mdi:minus-circle",
|
icon="mdi:minus-circle",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.VOICE_SWITCH,
|
key=DPCode.VOICE_SWITCH,
|
||||||
name="Voice",
|
name="Voice",
|
||||||
icon="mdi:account-voice",
|
icon="mdi:account-voice",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Siren Alarm
|
# Siren Alarm
|
||||||
|
@ -312,7 +312,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.MUFFLING,
|
key=DPCode.MUFFLING,
|
||||||
name="Mute",
|
name="Mute",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Smart Camera
|
# Smart Camera
|
||||||
|
@ -322,67 +322,67 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.WIRELESS_BATTERYLOCK,
|
key=DPCode.WIRELESS_BATTERYLOCK,
|
||||||
name="Battery Lock",
|
name="Battery Lock",
|
||||||
icon="mdi:battery-lock",
|
icon="mdi:battery-lock",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.CRY_DETECTION_SWITCH,
|
key=DPCode.CRY_DETECTION_SWITCH,
|
||||||
icon="mdi:emoticon-cry",
|
icon="mdi:emoticon-cry",
|
||||||
name="Cry Detection",
|
name="Cry Detection",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.DECIBEL_SWITCH,
|
key=DPCode.DECIBEL_SWITCH,
|
||||||
icon="mdi:microphone-outline",
|
icon="mdi:microphone-outline",
|
||||||
name="Sound Detection",
|
name="Sound Detection",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.RECORD_SWITCH,
|
key=DPCode.RECORD_SWITCH,
|
||||||
icon="mdi:record-rec",
|
icon="mdi:record-rec",
|
||||||
name="Video Recording",
|
name="Video Recording",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.MOTION_RECORD,
|
key=DPCode.MOTION_RECORD,
|
||||||
icon="mdi:record-rec",
|
icon="mdi:record-rec",
|
||||||
name="Motion Recording",
|
name="Motion Recording",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.BASIC_PRIVATE,
|
key=DPCode.BASIC_PRIVATE,
|
||||||
icon="mdi:eye-off",
|
icon="mdi:eye-off",
|
||||||
name="Privacy Mode",
|
name="Privacy Mode",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.BASIC_FLIP,
|
key=DPCode.BASIC_FLIP,
|
||||||
icon="mdi:flip-horizontal",
|
icon="mdi:flip-horizontal",
|
||||||
name="Flip",
|
name="Flip",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.BASIC_OSD,
|
key=DPCode.BASIC_OSD,
|
||||||
icon="mdi:watermark",
|
icon="mdi:watermark",
|
||||||
name="Time Watermark",
|
name="Time Watermark",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.BASIC_WDR,
|
key=DPCode.BASIC_WDR,
|
||||||
icon="mdi:watermark",
|
icon="mdi:watermark",
|
||||||
name="Wide Dynamic Range",
|
name="Wide Dynamic Range",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.MOTION_TRACKING,
|
key=DPCode.MOTION_TRACKING,
|
||||||
icon="mdi:motion-sensor",
|
icon="mdi:motion-sensor",
|
||||||
name="Motion Tracking",
|
name="Motion Tracking",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.MOTION_SWITCH,
|
key=DPCode.MOTION_SWITCH,
|
||||||
icon="mdi:motion-sensor",
|
icon="mdi:motion-sensor",
|
||||||
name="Motion Alarm",
|
name="Motion Alarm",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Fingerbot
|
# Fingerbot
|
||||||
|
@ -399,23 +399,23 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_1,
|
key=DPCode.SWITCH_1,
|
||||||
name="Switch 1",
|
name="Switch 1",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_2,
|
key=DPCode.SWITCH_2,
|
||||||
name="Switch 2",
|
name="Switch 2",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.SWITCH_3,
|
key=DPCode.SWITCH_3,
|
||||||
name="Switch 3",
|
name="Switch 3",
|
||||||
device_class=DEVICE_CLASS_OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
),
|
),
|
||||||
SwitchEntityDescription(
|
SwitchEntityDescription(
|
||||||
key=DPCode.CHILD_LOCK,
|
key=DPCode.CHILD_LOCK,
|
||||||
name="Child Lock",
|
name="Child Lock",
|
||||||
icon="mdi:account-lock",
|
icon="mdi:account-lock",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Solar Light
|
# Solar Light
|
||||||
|
@ -425,7 +425,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.SWITCH_SAVE_ENERGY,
|
key=DPCode.SWITCH_SAVE_ENERGY,
|
||||||
name="Energy Saving",
|
name="Energy Saving",
|
||||||
icon="mdi:leaf",
|
icon="mdi:leaf",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Ceiling Light
|
# Ceiling Light
|
||||||
|
@ -435,7 +435,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.DO_NOT_DISTURB,
|
key=DPCode.DO_NOT_DISTURB,
|
||||||
name="Do not disturb",
|
name="Do not disturb",
|
||||||
icon="mdi:minus-circle-outline",
|
icon="mdi:minus-circle-outline",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Diffuser
|
# Diffuser
|
||||||
|
@ -454,7 +454,7 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
|
||||||
key=DPCode.SWITCH_VOICE,
|
key=DPCode.SWITCH_VOICE,
|
||||||
name="Voice",
|
name="Voice",
|
||||||
icon="mdi:account-voice",
|
icon="mdi:account-voice",
|
||||||
entity_category=ENTITY_CATEGORY_CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
# Smart Electricity Meter
|
# Smart Electricity Meter
|
||||||
|
|
Loading…
Add table
Reference in a new issue