Add sensor total production energy for Tuya (#113565)

This commit is contained in:
Marcos A L M Macedo 2024-06-22 06:58:36 -03:00 committed by GitHub
parent ed2ad5ceaa
commit 03d8f4162e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View File

@ -166,6 +166,7 @@ class DPCode(StrEnum):
CRY_DETECTION_SWITCH = "cry_detection_switch"
CUP_NUMBER = "cup_number" # NUmber of cups
CUR_CURRENT = "cur_current" # Actual current
CUR_NEUTRAL = "cur_neutral" # Total reverse energy
CUR_POWER = "cur_power" # Actual power
CUR_VOLTAGE = "cur_voltage" # Actual voltage
DECIBEL_SENSITIVITY = "decibel_sensitivity"
@ -444,7 +445,7 @@ UNITS = (
),
UnitOfMeasurement(
unit=UnitOfEnergy.KILO_WATT_HOUR,
aliases={"kwh", "kilowatt-hour", "kW·h"},
aliases={"kwh", "kilowatt-hour", "kW·h", "kW.h"},
device_classes={SensorDeviceClass.ENERGY},
),
UnitOfMeasurement(

View File

@ -778,6 +778,12 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.CUR_NEUTRAL,
translation_key="total_production",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
TuyaSensorEntityDescription(
key=DPCode.PHASE_A,
translation_key="phase_a_current",

View File

@ -517,6 +517,9 @@
"total_energy": {
"name": "Total energy"
},
"total_production": {
"name": "Total production"
},
"phase_a_current": {
"name": "Phase A current"
},