Migrate Tuya to new entity naming style (#74975)

This commit is contained in:
Franck Nijhof 2022-07-11 18:17:54 +02:00 committed by GitHub
parent 75abf87611
commit 8d6925b3ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 125 additions and 134 deletions

View file

@ -58,7 +58,7 @@ BATTERY_SENSORS: tuple[TuyaSensorEntityDescription, ...] = (
),
TuyaSensorEntityDescription(
key=DPCode.BATTERY_STATE,
name="Battery State",
name="Battery state",
icon="mdi:battery",
entity_category=EntityCategory.DIAGNOSTIC,
),
@ -99,26 +99,26 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.VOC_VALUE,
name="Volatile Organic Compound",
name="Volatile organic compound",
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.PM25_VALUE,
name="Particulate Matter 2.5 µm",
name="Particulate matter 2.5 µm",
device_class=SensorDeviceClass.PM25,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.CO_VALUE,
name="Carbon Monoxide",
name="Carbon monoxide",
icon="mdi:molecule-co",
device_class=SensorDeviceClass.CO,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.CO2_VALUE,
name="Carbon Dioxide",
name="Carbon dioxide",
icon="mdi:molecule-co2",
device_class=SensorDeviceClass.CO2,
state_class=SensorStateClass.MEASUREMENT,
@ -154,7 +154,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.SMOKE_SENSOR_VALUE,
name="Smoke Amount",
name="Smoke amount",
icon="mdi:smoke-detector",
entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorStateClass.MEASUREMENT,
@ -166,13 +166,13 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"bh": (
TuyaSensorEntityDescription(
key=DPCode.TEMP_CURRENT,
name="Current Temperature",
name="Current temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.TEMP_CURRENT_F,
name="Current Temperature",
name="Current temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
@ -199,7 +199,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.CO2_VALUE,
name="Carbon Dioxide",
name="Carbon dioxide",
device_class=SensorDeviceClass.CO2,
state_class=SensorStateClass.MEASUREMENT,
),
@ -210,7 +210,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"cobj": (
TuyaSensorEntityDescription(
key=DPCode.CO_VALUE,
name="Carbon Monoxide",
name="Carbon monoxide",
device_class=SensorDeviceClass.CO,
state_class=SensorStateClass.MEASUREMENT,
),
@ -221,7 +221,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"cwwsq": (
TuyaSensorEntityDescription(
key=DPCode.FEED_REPORT,
name="Last Amount",
name="Last amount",
icon="mdi:counter",
state_class=SensorStateClass.MEASUREMENT,
),
@ -243,7 +243,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.CO2_VALUE,
name="Carbon Dioxide",
name="Carbon dioxide",
device_class=SensorDeviceClass.CO2,
state_class=SensorStateClass.MEASUREMENT,
),
@ -254,13 +254,13 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.VOC_VALUE,
name="Volatile Organic Compound",
name="Volatile organic compound",
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.PM25_VALUE,
name="Particulate Matter 2.5 µm",
name="Particulate matter 2.5 µm",
device_class=SensorDeviceClass.PM25,
state_class=SensorStateClass.MEASUREMENT,
),
@ -270,19 +270,19 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"jqbj": (
TuyaSensorEntityDescription(
key=DPCode.CO2_VALUE,
name="Carbon Dioxide",
name="Carbon dioxide",
device_class=SensorDeviceClass.CO2,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.VOC_VALUE,
name="Volatile Organic Compound",
name="Volatile organic compound",
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.PM25_VALUE,
name="Particulate Matter 2.5 µm",
name="Particulate matter 2.5 µm",
device_class=SensorDeviceClass.PM25,
state_class=SensorStateClass.MEASUREMENT,
),
@ -368,7 +368,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.CO2_VALUE,
name="Carbon Dioxide",
name="Carbon dioxide",
device_class=SensorDeviceClass.CO2,
state_class=SensorStateClass.MEASUREMENT,
),
@ -385,7 +385,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"mzj": (
TuyaSensorEntityDescription(
key=DPCode.TEMP_CURRENT,
name="Current Temperature",
name="Current temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
@ -396,7 +396,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.REMAIN_TIME,
name="Remaining Time",
name="Remaining time",
native_unit_of_measurement=TIME_MINUTES,
icon="mdi:timer",
),
@ -409,7 +409,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"pm2.5": (
TuyaSensorEntityDescription(
key=DPCode.PM25_VALUE,
name="Particulate Matter 2.5 µm",
name="Particulate matter 2.5 µm",
device_class=SensorDeviceClass.PM25,
state_class=SensorStateClass.MEASUREMENT,
),
@ -420,7 +420,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.VOC_VALUE,
name="Volatile Organic Compound",
name="Volatile organic compound",
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
state_class=SensorStateClass.MEASUREMENT,
),
@ -432,7 +432,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.CO2_VALUE,
name="Carbon Dioxide",
name="Carbon dioxide",
device_class=SensorDeviceClass.CO2,
state_class=SensorStateClass.MEASUREMENT,
),
@ -444,13 +444,13 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PM1,
name="Particulate Matter 1.0 µm",
name="Particulate matter 1.0 µm",
device_class=SensorDeviceClass.PM1,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.PM10,
name="Particulate Matter 10.0 µm",
name="Particulate matter 10.0 µm",
device_class=SensorDeviceClass.PM10,
state_class=SensorStateClass.MEASUREMENT,
),
@ -515,13 +515,13 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"voc": (
TuyaSensorEntityDescription(
key=DPCode.CO2_VALUE,
name="Carbon Dioxide",
name="Carbon dioxide",
device_class=SensorDeviceClass.CO2,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.PM25_VALUE,
name="Particulate Matter 2.5 µm",
name="Particulate matter 2.5 µm",
device_class=SensorDeviceClass.PM25,
state_class=SensorStateClass.MEASUREMENT,
),
@ -544,7 +544,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.VOC_VALUE,
name="Volatile Organic Compound",
name="Volatile organic compound",
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
state_class=SensorStateClass.MEASUREMENT,
),
@ -603,7 +603,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"ywbj": (
TuyaSensorEntityDescription(
key=DPCode.SMOKE_SENSOR_VALUE,
name="Smoke Amount",
name="Smoke amount",
icon="mdi:smoke-detector",
entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorStateClass.MEASUREMENT,
@ -618,13 +618,13 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"zndb": (
TuyaSensorEntityDescription(
key=DPCode.FORWARD_ENERGY_TOTAL,
name="Total Energy",
name="Total energy",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_A,
name="Phase A Current",
name="Phase A current",
device_class=SensorDeviceClass.CURRENT,
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
state_class=SensorStateClass.MEASUREMENT,
@ -632,7 +632,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_A,
name="Phase A Power",
name="Phase A power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=POWER_KILO_WATT,
@ -640,7 +640,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_A,
name="Phase A Voltage",
name="Phase A voltage",
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
@ -648,7 +648,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_B,
name="Phase B Current",
name="Phase B current",
device_class=SensorDeviceClass.CURRENT,
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
state_class=SensorStateClass.MEASUREMENT,
@ -656,7 +656,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_B,
name="Phase B Power",
name="Phase B power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=POWER_KILO_WATT,
@ -664,7 +664,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_B,
name="Phase B Voltage",
name="Phase B voltage",
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
@ -672,7 +672,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_C,
name="Phase C Current",
name="Phase C current",
device_class=SensorDeviceClass.CURRENT,
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
state_class=SensorStateClass.MEASUREMENT,
@ -680,7 +680,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_C,
name="Phase C Power",
name="Phase C power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=POWER_KILO_WATT,
@ -688,7 +688,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_C,
name="Phase C Voltage",
name="Phase C voltage",
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
@ -700,13 +700,13 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"dlq": (
TuyaSensorEntityDescription(
key=DPCode.TOTAL_FORWARD_ENERGY,
name="Total Energy",
name="Total energy",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_A,
name="Phase A Current",
name="Phase A current",
device_class=SensorDeviceClass.CURRENT,
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
state_class=SensorStateClass.MEASUREMENT,
@ -714,7 +714,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_A,
name="Phase A Power",
name="Phase A power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=POWER_KILO_WATT,
@ -722,7 +722,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_A,
name="Phase A Voltage",
name="Phase A voltage",
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
@ -730,7 +730,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_B,
name="Phase B Current",
name="Phase B current",
device_class=SensorDeviceClass.CURRENT,
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
state_class=SensorStateClass.MEASUREMENT,
@ -738,7 +738,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_B,
name="Phase B Power",
name="Phase B power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=POWER_KILO_WATT,
@ -746,7 +746,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_B,
name="Phase B Voltage",
name="Phase B voltage",
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
@ -754,7 +754,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_C,
name="Phase C Current",
name="Phase C current",
device_class=SensorDeviceClass.CURRENT,
native_unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
state_class=SensorStateClass.MEASUREMENT,
@ -762,7 +762,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_C,
name="Phase C Power",
name="Phase C power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=POWER_KILO_WATT,
@ -770,7 +770,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_C,
name="Phase C Voltage",
name="Phase C voltage",
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
@ -782,13 +782,13 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"sd": (
TuyaSensorEntityDescription(
key=DPCode.CLEAN_AREA,
name="Cleaning Area",
name="Cleaning area",
icon="mdi:texture-box",
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.CLEAN_TIME,
name="Cleaning Time",
name="Cleaning time",
icon="mdi:progress-clock",
state_class=SensorStateClass.MEASUREMENT,
),
@ -800,37 +800,37 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.TOTAL_CLEAN_TIME,
name="Total Cleaning Time",
name="Total cleaning time",
icon="mdi:history",
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.TOTAL_CLEAN_COUNT,
name="Total Cleaning Times",
name="Total cleaning times",
icon="mdi:counter",
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.DUSTER_CLOTH,
name="Duster Cloth Life",
name="Duster cloth life",
icon="mdi:ticket-percent-outline",
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.EDGE_BRUSH,
name="Side Brush Life",
name="Side brush life",
icon="mdi:ticket-percent-outline",
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.FILTER_LIFE,
name="Filter Life",
name="Filter life",
icon="mdi:ticket-percent-outline",
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.ROLL_BRUSH,
name="Rolling Brush Life",
name="Rolling brush life",
icon="mdi:ticket-percent-outline",
state_class=SensorStateClass.MEASUREMENT,
),
@ -840,7 +840,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"cl": (
TuyaSensorEntityDescription(
key=DPCode.TIME_TOTAL,
name="Last Operation Duration",
name="Last operation duration",
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:progress-clock",
),
@ -868,7 +868,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.LEVEL_CURRENT,
name="Water Level",
name="Water level",
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:waves-arrow-up",
),
@ -878,13 +878,13 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
"kj": (
TuyaSensorEntityDescription(
key=DPCode.FILTER,
name="Filter Utilization",
name="Filter utilization",
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:ticket-percent-outline",
),
TuyaSensorEntityDescription(
key=DPCode.PM25,
name="Particulate Matter 2.5 µm",
name="Particulate matter 2.5 µm",
device_class=SensorDeviceClass.PM25,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:molecule",
@ -903,26 +903,26 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
TuyaSensorEntityDescription(
key=DPCode.TVOC,
name="Total Volatile Organic Compound",
name="Total volatile organic compound",
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.ECO2,
name="Concentration of Carbon Dioxide",
name="Concentration of carbon dioxide",
device_class=SensorDeviceClass.CO2,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.TOTAL_TIME,
name="Total Operating Time",
name="Total operating time",
icon="mdi:history",
state_class=SensorStateClass.TOTAL_INCREASING,
entity_category=EntityCategory.DIAGNOSTIC,
),
TuyaSensorEntityDescription(
key=DPCode.TOTAL_PM,
name="Total Absorption of Particles",
name="Total absorption of particles",
icon="mdi:texture-box",
state_class=SensorStateClass.TOTAL_INCREASING,
entity_category=EntityCategory.DIAGNOSTIC,