Skip to content

Commit b98167f

Browse files
committed
fix: fixed issue when COP not provided by heat pump (10 minutes dev time)
1 parent d502160 commit b98167f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

custom_components/octopus_energy/api_client/heat_pump.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ class OctoHeatPumpControllerConfiguration(BaseModel):
123123

124124

125125
class OctoHeatPumpLivePerformance(BaseModel):
126-
coefficientOfPerformance: str
126+
coefficientOfPerformance: str | None
127127
heatOutput: ValueAndUnit
128128
powerInput: ValueAndUnit
129129
outdoorTemperature: ValueAndUnit
130130
readAt: str
131131

132132

133133
class OctoHeatPumpLifetimePerformance(BaseModel):
134-
seasonalCoefficientOfPerformance: str
134+
seasonalCoefficientOfPerformance: str | None
135135
heatOutput: ValueAndUnit
136136
energyInput: ValueAndUnit
137137
readAt: str

custom_components/octopus_energy/heat_pump/sensor_lifetime_scop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _handle_coordinator_update(self) -> None:
7373
and result.data.octoHeatPumpLifetimePerformance is not None):
7474
_LOGGER.debug(f"Updating OctopusEnergyHeatPumpSensorLifetimeSCoP for '{self._heat_pump_id}'")
7575

76-
self._state = float(result.data.octoHeatPumpLifetimePerformance.seasonalCoefficientOfPerformance)
76+
self._state = float(result.data.octoHeatPumpLifetimePerformance.seasonalCoefficientOfPerformance) if result.data.octoHeatPumpLifetimePerformance.seasonalCoefficientOfPerformance is not None else None
7777
self._attributes["read_at"] = datetime.fromisoformat(result.data.octoHeatPumpLifetimePerformance.readAt)
7878
self._last_updated = current
7979

custom_components/octopus_energy/heat_pump/sensor_live_cop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _handle_coordinator_update(self) -> None:
7676
self._state = 0
7777
# Only update the CoP if heat pump is actively running
7878
if float(result.data.octoHeatPumpLivePerformance.powerInput.value) != 0:
79-
self._state = float(result.data.octoHeatPumpLivePerformance.coefficientOfPerformance)
79+
self._state = float(result.data.octoHeatPumpLivePerformance.coefficientOfPerformance) if result.data.octoHeatPumpLivePerformance.coefficientOfPerformanc is not None else None
8080

8181
self._attributes["read_at"] = datetime.fromisoformat(result.data.octoHeatPumpLivePerformance.readAt)
8282
self._last_updated = current

0 commit comments

Comments
 (0)