diff --git a/custom_components/sonoff/core/devices.py b/custom_components/sonoff/core/devices.py index 72494028..90043dfc 100644 --- a/custom_components/sonoff/core/devices.py +++ b/custom_components/sonoff/core/devices.py @@ -318,6 +318,8 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: spec(XSensor100, param="current"), spec(XSensor100, param="power"), spec(XSensor100, param="voltage"), + spec(XSensor100, param="dayKwh", uid="energy_day"), + spec(XSensor100, param="monthKwh", uid="energy_month"), spec( XEnergySensorPOWR3, param="hoursKwhData", diff --git a/custom_components/sonoff/sensor.py b/custom_components/sonoff/sensor.py index f1645dd1..fbbe88e1 100644 --- a/custom_components/sonoff/sensor.py +++ b/custom_components/sonoff/sensor.py @@ -38,6 +38,8 @@ async def async_setup_entry(hass, config_entry, add_entities): "battery": SensorDeviceClass.BATTERY, "battery_voltage": SensorDeviceClass.VOLTAGE, "current": SensorDeviceClass.CURRENT, + "energy_day": SensorDeviceClass.ENERGY, + "energy_month": SensorDeviceClass.ENERGY, "humidity": SensorDeviceClass.HUMIDITY, "outdoor_temp": SensorDeviceClass.TEMPERATURE, "power": SensorDeviceClass.POWER, @@ -50,6 +52,8 @@ async def async_setup_entry(hass, config_entry, add_entities): "battery": PERCENTAGE, "battery_voltage": ELECTRIC_POTENTIAL_VOLT, "current": ELECTRIC_CURRENT_AMPERE, + "energy_day": ENERGY_KILO_WATT_HOUR, + "energy_month": ENERGY_KILO_WATT_HOUR, "humidity": PERCENTAGE, "outdoor_temp": TEMP_CELSIUS, "power": POWER_WATT,