updated apps
This commit is contained in:
@@ -25,6 +25,7 @@ from custom_components.powercalc.const import (
|
||||
SIGNAL_POWER_SENSOR_STATE_CHANGE,
|
||||
)
|
||||
from custom_components.powercalc.sensors.energy import create_energy_sensor
|
||||
from custom_components.powercalc.sensors.energy_related import create_energy_related_sensors
|
||||
from custom_components.powercalc.sensors.power import PowerSensor
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -52,10 +53,11 @@ def create_general_standby_sensors(
|
||||
source_entity,
|
||||
)
|
||||
sensors.append(energy_sensor)
|
||||
sensors.extend(create_energy_related_sensors(hass, sensor_config, energy_sensor, source_entity))
|
||||
return sensors
|
||||
|
||||
|
||||
class StandbyPowerSensor(SensorEntity, PowerSensor):
|
||||
class StandbyPowerSensor(PowerSensor, SensorEntity):
|
||||
_attr_device_class = SensorDeviceClass.POWER
|
||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||
_attr_native_unit_of_measurement = UnitOfPower.WATT
|
||||
@@ -70,10 +72,12 @@ class StandbyPowerSensor(SensorEntity, PowerSensor):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register state listeners."""
|
||||
await super().async_added_to_hass()
|
||||
async_dispatcher_connect(
|
||||
self.hass,
|
||||
SIGNAL_POWER_SENSOR_STATE_CHANGE,
|
||||
self._recalculate,
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass,
|
||||
SIGNAL_POWER_SENSOR_STATE_CHANGE,
|
||||
self._recalculate,
|
||||
),
|
||||
)
|
||||
|
||||
async def _recalculate(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user