Initil after Upgrade
This commit is contained in:
@@ -48,7 +48,11 @@ class WledStrategy(PowerCalculationStrategyInterface):
|
||||
self._estimated_current_entity: str | None = None
|
||||
|
||||
async def calculate(self, entity_state: State) -> Decimal | None:
|
||||
light_state = entity_state if entity_state.entity_id == self._light_entity.entity_id else self._hass.states.get(self._light_entity.entity_id)
|
||||
light_state = (
|
||||
entity_state
|
||||
if entity_state.entity_id == self._light_entity.entity_id
|
||||
else self._hass.states.get(self._light_entity.entity_id)
|
||||
)
|
||||
|
||||
if light_state.state in OFF_STATES and self._standby_power:
|
||||
return self._standby_power
|
||||
@@ -72,7 +76,7 @@ class WledStrategy(PowerCalculationStrategyInterface):
|
||||
self._power_factor,
|
||||
)
|
||||
power = float(entity_state.state) / 1000 * self._voltage * self._power_factor
|
||||
return await evaluate_power(power)
|
||||
return evaluate_power(power)
|
||||
|
||||
async def find_estimated_current_entity(self) -> str:
|
||||
entity_reg = entity_registry.async_get(self._hass)
|
||||
@@ -86,7 +90,9 @@ class WledStrategy(PowerCalculationStrategyInterface):
|
||||
if entity:
|
||||
return entity
|
||||
|
||||
raise StrategyConfigurationError("No estimated current entity found. Probably brightness limiter not enabled. See documentation")
|
||||
raise StrategyConfigurationError(
|
||||
"No estimated current entity found. Probably brightness limiter not enabled. See documentation",
|
||||
)
|
||||
|
||||
def get_entities_to_track(self) -> list[str | TrackTemplate]:
|
||||
if self._estimated_current_entity:
|
||||
|
||||
Reference in New Issue
Block a user