393 files

This commit is contained in:
Home Assistant Version Control
2026-09-27 17:16:54 +00:00
parent b05b7a897e
commit 39d97ac2db
404 changed files with 54006 additions and 11034 deletions
@@ -41,10 +41,12 @@ class MultiSwitchStrategy(PowerCalculationStrategyInterface):
async def calculate(self, entity_state: State) -> Decimal | None:
if self.known_states is None:
self.known_states = {
entity_id: (state.state if (state := self.hass.states.get(entity_id)) else STATE_UNAVAILABLE)
for entity_id in self.switch_entities
}
self.known_states = dict.fromkeys(self.switch_entities, STATE_UNAVAILABLE)
for entity_id in self.switch_entities:
state = self.hass.states.get(entity_id)
if state is not None:
self.known_states[entity_id] = state.state
if entity_state.entity_id != DUMMY_ENTITY_ID and entity_state.entity_id in self.switch_entities:
self.known_states[entity_state.entity_id] = entity_state.state