updated apps

This commit is contained in:
2026-07-14 23:57:03 -04:00
parent 6cc7212cef
commit 010e828e9c
797 changed files with 45153 additions and 4246 deletions
@@ -9,6 +9,7 @@ from typing import Any
from homeassistant.const import CONF_ATTRIBUTE, CONF_CONDITION, CONF_ENTITY_ID, STATE_OFF
from homeassistant.core import HomeAssistant, State
from homeassistant.exceptions import ConditionError
from homeassistant.helpers.condition import ConditionCheckerType
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import TrackTemplate
@@ -152,15 +153,13 @@ class CompositeStrategy(PowerCalculationStrategyInterface):
for sub_strategy in self.strategies:
strategy = sub_strategy.strategy
if sub_strategy.condition and not sub_strategy.condition(self.hass, {"state": entity_state}):
if sub_strategy.condition and not self._condition_matches(sub_strategy.condition, entity_state):
continue
if isinstance(strategy, PlaybookStrategy):
await self.activate_playbook(strategy)
if (
entity_state.state == STATE_OFF and strategy.can_calculate_standby()
) or entity_state.state != STATE_OFF:
if entity_state.state != STATE_OFF or strategy.can_calculate_standby():
value = await strategy.calculate(entity_state)
if value is not None:
if self.mode == CompositeMode.STOP_AT_FIRST:
@@ -169,6 +168,13 @@ class CompositeStrategy(PowerCalculationStrategyInterface):
return total if self.mode == CompositeMode.SUM_ALL else None
def _condition_matches(self, condition: ConditionCheckerType, entity_state: State) -> bool:
try:
return condition(self.hass, {"state": entity_state})
except ConditionError:
_LOGGER.debug("Skipping composite sub-strategy because condition evaluation failed", exc_info=True)
return False
async def stop_active_playbooks(self) -> None:
"""Stop any active playbooks from sub strategies."""
for playbook in self.playbook_strategies: