Skip to content

Commit

Permalink
fix: Fixed issue with boosting water heat pump zones when target temp…
Browse files Browse the repository at this point in the history
…erature is not defined. This will now boost with a default temperature. See docs for more information
  • Loading branch information
BottlecapDave committed Jan 18, 2025
1 parent 79fe1a7 commit ff7fa9b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
4 changes: 4 additions & 0 deletions _docs/entities/heat_pump.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ The following operation modes are available

In addition, there is the preset of `boost`, which activates boost mode for the zone for 1 hour. If you require boost to be on for a different amount of time, then you can use the [available service](../services.md#octopus_energyboost_heat_pump_zone).

!!! note

If you boost and a target temperature is not defined, then a default value will be set. This will be 50 degrees C for `water` zones and 30 degrees C for all other zones.

## Lifetime Seasonal Coefficient of Performance

`sensor.octopus_energy_heat_pump_{{HEAT_PUMP_ID}}_lifetime_scop`
Expand Down
3 changes: 3 additions & 0 deletions _docs/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ Allows you to boost a given heat pump zone for a set amount of time.
| `data.minutes` | `no` | The number of minutes to turn boost mode on for. This can be 0, 15, or 45. |
| `data.target_temperature` | `yes` | The optional target temperature to boost to. If not supplied, then the current target temperature will be used. |

!!! note

If you boost and a target temperature is both not provided and not defined on the sensor itself, then a default value will be set. This will be 50 degrees C for `water` zones and 30 degrees C for all other zones.

## octopus_energy.set_heat_pump_flow_temp_config

Expand Down
2 changes: 2 additions & 0 deletions custom_components/octopus_energy/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@
REGEX_WEIGHTING = f"^({REGEX_WEIGHTING_NUMBERS}|{REGEX_WEIGHTING_START}|{REGEX_WEIGHTING_MIDDLE}|{REGEX_WEIGHTING_END})$"

DEFAULT_CALORIFIC_VALUE = 40.0
DEFAULT_BOOST_TEMPERATURE_WATER = 50
DEFAULT_BOOST_TEMPERATURE_HEAT = 30

DATA_SCHEMA_ACCOUNT = vol.Schema({
vol.Required(CONFIG_ACCOUNT_ID): str,
Expand Down
28 changes: 25 additions & 3 deletions custom_components/octopus_energy/heat_pump/zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import logging
from typing import List

from custom_components.octopus_energy.const import DOMAIN
from homeassistant.util.dt import (utcnow)
from homeassistant.exceptions import ServiceValidationError

Expand Down Expand Up @@ -32,6 +31,7 @@
from ..api_client.heat_pump import ConfigurationZone, HeatPump, Sensor, Zone
from ..coordinators.heat_pump_configuration_and_status import HeatPumpCoordinatorResult
from ..api_client import OctopusEnergyApiClient
from ..const import DEFAULT_BOOST_TEMPERATURE_HEAT, DEFAULT_BOOST_TEMPERATURE_WATER, DOMAIN

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -194,7 +194,18 @@ async def async_set_preset_mode(self, preset_mode):
if self._attr_preset_mode == PRESET_BOOST:
self._end_timestamp = utcnow()
self._end_timestamp += timedelta(hours=1)
await self._client.async_boost_heat_pump_zone(self._account_id, self._heat_pump_id, self._zone.configuration.code, self._end_timestamp, self._attr_target_temperature)

boost_temperature = self._attr_target_temperature
if boost_temperature is None:
boost_temperature = DEFAULT_BOOST_TEMPERATURE_WATER if self._zone.configuration.zoneType == "WATER" else DEFAULT_BOOST_TEMPERATURE_HEAT

await self._client.async_boost_heat_pump_zone(
self._account_id,
self._heat_pump_id,
self._zone.configuration.code,
self._end_timestamp,
boost_temperature
)
else:
zone_mode = self.get_zone_mode()
await self._client.async_set_heat_pump_zone_mode(self._account_id, self._heat_pump_id, self._zone.configuration.code, zone_mode, self._attr_target_temperature)
Expand Down Expand Up @@ -242,7 +253,18 @@ async def async_boost_heat_pump_zone(self, hours: int, minutes: int, target_temp
self._end_timestamp = utcnow()
self._end_timestamp += timedelta(hours=hours, minutes=minutes)
self._attr_preset_mode = PRESET_BOOST
await self._client.async_boost_heat_pump_zone(self._account_id, self._heat_pump_id, self._zone.configuration.code, self._end_timestamp, target_temperature if target_temperature is not None else self._attr_target_temperature)

boost_temperature = target_temperature if target_temperature is not None else self._attr_target_temperature
if boost_temperature is None:
boost_temperature = DEFAULT_BOOST_TEMPERATURE_WATER if self._zone.configuration.zoneType == "WATER" else DEFAULT_BOOST_TEMPERATURE_HEAT

await self._client.async_boost_heat_pump_zone(
self._account_id,
self._heat_pump_id,
self._zone.configuration.code,
self._end_timestamp,
boost_temperature
)

self.async_write_ha_state()

Expand Down

0 comments on commit ff7fa9b

Please sign in to comment.