Remove extra attributes from pvoutput sensors (#68481)
This commit is contained in:
parent
d065475aac
commit
1f135a20a0
2 changed files with 1 additions and 35 deletions
|
@ -14,10 +14,4 @@ LOGGER = logging.getLogger(__package__)
|
|||
SCAN_INTERVAL = timedelta(minutes=2)
|
||||
|
||||
|
||||
ATTR_ENERGY_GENERATION = "energy_generation"
|
||||
ATTR_POWER_GENERATION = "power_generation"
|
||||
ATTR_ENERGY_CONSUMPTION = "energy_consumption"
|
||||
ATTR_POWER_CONSUMPTION = "power_consumption"
|
||||
ATTR_EFFICIENCY = "efficiency"
|
||||
|
||||
CONF_SYSTEM_ID = "system_id"
|
||||
|
|
|
@ -14,8 +14,6 @@ from homeassistant.components.sensor import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_TEMPERATURE,
|
||||
ATTR_VOLTAGE,
|
||||
ELECTRIC_POTENTIAL_VOLT,
|
||||
ENERGY_KILO_WATT_HOUR,
|
||||
ENERGY_WATT_HOUR,
|
||||
|
@ -28,15 +26,7 @@ from homeassistant.helpers.entity import DeviceInfo
|
|||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import (
|
||||
ATTR_EFFICIENCY,
|
||||
ATTR_ENERGY_CONSUMPTION,
|
||||
ATTR_ENERGY_GENERATION,
|
||||
ATTR_POWER_CONSUMPTION,
|
||||
ATTR_POWER_GENERATION,
|
||||
CONF_SYSTEM_ID,
|
||||
DOMAIN,
|
||||
)
|
||||
from .const import CONF_SYSTEM_ID, DOMAIN
|
||||
from .coordinator import PVOutputDataUpdateCoordinator
|
||||
|
||||
|
||||
|
@ -164,21 +154,3 @@ class PVOutputSensorEntity(
|
|||
def native_value(self) -> int | float | None:
|
||||
"""Return the state of the device."""
|
||||
return self.entity_description.value_fn(self.coordinator.data)
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, int | float | None] | None:
|
||||
"""Return the state attributes of the monitored installation."""
|
||||
|
||||
# Only add attributes to the original sensor
|
||||
if self.entity_description.key != "energy_generation":
|
||||
return None
|
||||
|
||||
return {
|
||||
ATTR_ENERGY_GENERATION: self.coordinator.data.energy_generation,
|
||||
ATTR_POWER_GENERATION: self.coordinator.data.power_generation,
|
||||
ATTR_ENERGY_CONSUMPTION: self.coordinator.data.energy_consumption,
|
||||
ATTR_POWER_CONSUMPTION: self.coordinator.data.power_consumption,
|
||||
ATTR_EFFICIENCY: self.coordinator.data.normalized_output,
|
||||
ATTR_TEMPERATURE: self.coordinator.data.temperature,
|
||||
ATTR_VOLTAGE: self.coordinator.data.voltage,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue