From 1bbfe7854fee627600bc122cfc665d90241948e1 Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Sat, 22 Jun 2024 19:58:54 +1000 Subject: [PATCH] Add Tuya reverse_energy_total and total_power sensors (#114801) Co-authored-by: Franck Nijhof --- homeassistant/components/tuya/const.py | 1 + homeassistant/components/tuya/sensor.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index 524cd0a4983..3b0d22e8cf7 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -345,6 +345,7 @@ class DPCode(StrEnum): TOTAL_FORWARD_ENERGY = "total_forward_energy" TOTAL_TIME = "total_time" TOTAL_PM = "total_pm" + TOTAL_POWER = "total_power" TVOC = "tvoc" UPPER_TEMP = "upper_temp" UPPER_TEMP_F = "upper_temp_f" diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index 1468f90a452..78e3976a416 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -696,6 +696,20 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = { device_class=SensorDeviceClass.ENERGY, state_class=SensorStateClass.TOTAL_INCREASING, ), + TuyaSensorEntityDescription( + key=DPCode.REVERSE_ENERGY_TOTAL, + translation_key="total_energy", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + ), + TuyaSensorEntityDescription( + key=DPCode.TOTAL_POWER, + translation_key="total_power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfPower.KILO_WATT, + subkey="power", + ), TuyaSensorEntityDescription( key=DPCode.PHASE_A, translation_key="phase_a_current",