Skip to content

Commit

Permalink
fix: calculation issues multiswitch
Browse files Browse the repository at this point in the history
  • Loading branch information
bramstroker committed Jan 3, 2025
1 parent 2c087d4 commit 700f59b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/powercalc/sensors/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ async def calculate_power(self, state: State) -> Decimal | None:
standby_power = await self.calculate_standby_power(entity_state)
self._standby_sensors[self.entity_id] = standby_power

if self._calculation_strategy != CalculationStrategy.MULTI_SWITCH:
if self._strategy_instance.can_calculate_standby() or self._calculation_strategy != CalculationStrategy.MULTI_SWITCH:
return standby_power

# Calculate actual power using configured strategy
Expand Down
2 changes: 1 addition & 1 deletion custom_components/powercalc/strategy/multi_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ def get_entities_to_track(self) -> list[str | TrackTemplate]:
return self.switch_entities # type: ignore

def can_calculate_standby(self) -> bool:
return False
return self.off_power is not None

0 comments on commit 700f59b

Please sign in to comment.