Skip to content

Commit

Permalink
Adds energy_day and energy_month to the POWR316 #1114
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Mar 31, 2023
1 parent e246869 commit 5eaf029
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom_components/sonoff/core/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions custom_components/sonoff/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 5eaf029

Please sign in to comment.