393 files
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user