mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add state class to Enphase Envoy (#52113)
This commit is contained in:
parent
38daf94562
commit
5b663b1fb9
@ -1,6 +1,7 @@
|
||||
"""The enphase_envoy component."""
|
||||
|
||||
|
||||
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT
|
||||
from homeassistant.const import ENERGY_WATT_HOUR, POWER_WATT
|
||||
|
||||
DOMAIN = "enphase_envoy"
|
||||
@ -12,19 +13,21 @@ COORDINATOR = "coordinator"
|
||||
NAME = "name"
|
||||
|
||||
SENSORS = {
|
||||
"production": ("Current Energy Production", POWER_WATT),
|
||||
"daily_production": ("Today's Energy Production", ENERGY_WATT_HOUR),
|
||||
"production": ("Current Energy Production", POWER_WATT, STATE_CLASS_MEASUREMENT),
|
||||
"daily_production": ("Today's Energy Production", ENERGY_WATT_HOUR, None),
|
||||
"seven_days_production": (
|
||||
"Last Seven Days Energy Production",
|
||||
ENERGY_WATT_HOUR,
|
||||
None,
|
||||
),
|
||||
"lifetime_production": ("Lifetime Energy Production", ENERGY_WATT_HOUR),
|
||||
"consumption": ("Current Energy Consumption", POWER_WATT),
|
||||
"daily_consumption": ("Today's Energy Consumption", ENERGY_WATT_HOUR),
|
||||
"lifetime_production": ("Lifetime Energy Production", ENERGY_WATT_HOUR, None),
|
||||
"consumption": ("Current Energy Consumption", POWER_WATT, STATE_CLASS_MEASUREMENT),
|
||||
"daily_consumption": ("Today's Energy Consumption", ENERGY_WATT_HOUR, None),
|
||||
"seven_days_consumption": (
|
||||
"Last Seven Days Energy Consumption",
|
||||
ENERGY_WATT_HOUR,
|
||||
None,
|
||||
),
|
||||
"lifetime_consumption": ("Lifetime Energy Consumption", ENERGY_WATT_HOUR),
|
||||
"inverters": ("Inverter", POWER_WATT),
|
||||
"lifetime_consumption": ("Lifetime Energy Consumption", ENERGY_WATT_HOUR, None),
|
||||
"inverters": ("Inverter", POWER_WATT, STATE_CLASS_MEASUREMENT),
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
config_entry.unique_id,
|
||||
serial_number,
|
||||
SENSORS[condition][1],
|
||||
SENSORS[condition][2],
|
||||
coordinator,
|
||||
)
|
||||
)
|
||||
@ -91,6 +92,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
config_entry.unique_id,
|
||||
None,
|
||||
SENSORS[condition][1],
|
||||
SENSORS[condition][2],
|
||||
coordinator,
|
||||
)
|
||||
)
|
||||
@ -109,6 +111,7 @@ class Envoy(CoordinatorEntity, SensorEntity):
|
||||
device_serial_number,
|
||||
serial_number,
|
||||
unit,
|
||||
state_class,
|
||||
coordinator,
|
||||
):
|
||||
"""Initialize Envoy entity."""
|
||||
@ -118,6 +121,7 @@ class Envoy(CoordinatorEntity, SensorEntity):
|
||||
self._device_name = device_name
|
||||
self._device_serial_number = device_serial_number
|
||||
self._unit_of_measurement = unit
|
||||
self._attr_state_class = state_class
|
||||
|
||||
super().__init__(coordinator)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user