Skip to content

Commit f0f0443

Browse files
Next release (#1177)
2 parents 8041f33 + 68550fb commit f0f0443

File tree

6 files changed

+51
-8
lines changed

6 files changed

+51
-8
lines changed

_docs/entities/heat_pump.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ The following operation modes are available
3030

3131
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).
3232

33+
!!! note
34+
35+
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.
36+
3337
## Lifetime Seasonal Coefficient of Performance
3438

3539
`sensor.octopus_energy_heat_pump_{{HEAT_PUMP_ID}}_lifetime_scop`

_docs/services.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ Allows you to boost a given heat pump zone for a set amount of time.
274274
| `data.minutes` | `no` | The number of minutes to turn boost mode on for. This can be 0, 15, or 45. |
275275
| `data.target_temperature` | `yes` | The optional target temperature to boost to. If not supplied, then the current target temperature will be used. |
276276

277+
!!! note
278+
279+
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.
277280

278281
## octopus_energy.set_heat_pump_flow_temp_config
279282

custom_components/octopus_energy/api_client/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,10 +1217,11 @@ async def async_get_electricity_consumption(self, mpan: str, serial_number: str,
12171217
for item in data:
12181218
item = self.__process_consumption(item)
12191219

1220-
# For some reason, the end point returns slightly more data than we requested, so we need to filter out
1221-
# the results
1220+
# For some reason, the end point sometimes returns slightly more data than we requested, so we need to filter out the results
12221221
if (period_from is None or as_utc(item["start"]) >= period_from) and (period_to is None or as_utc(item["end"]) <= period_to):
12231222
results.append(item)
1223+
else:
1224+
_LOGGER.debug(f'Skipping gas consumption item due to outside requested scope - period_from: {period_from}; period_to: {period_to}; item: {item}; mpan: {mpan}; serial_number: {serial_number}')
12241225

12251226
results.sort(key=self.__get_interval_end)
12261227
return results
@@ -1279,7 +1280,12 @@ async def async_get_gas_consumption(self, mprn: str, serial_number: str, period_
12791280
results = []
12801281
for item in data:
12811282
item = self.__process_consumption(item)
1282-
results.append(item)
1283+
1284+
# For some reason, the end point sometimes returns slightly more data than we requested, so we need to filter out the results
1285+
if (period_from is None or as_utc(item["start"]) >= period_from) and (period_to is None or as_utc(item["end"]) <= period_to):
1286+
results.append(item)
1287+
else:
1288+
_LOGGER.debug(f'Skipping gas consumption item due to outside requested scope - period_from: {period_from}; period_to: {period_to}; item: {item}; mprn: {mprn}; serial_number: {serial_number}')
12831289

12841290
results.sort(key=self.__get_interval_end)
12851291
return results

custom_components/octopus_energy/const.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@
174174
REGEX_WEIGHTING = f"^({REGEX_WEIGHTING_NUMBERS}|{REGEX_WEIGHTING_START}|{REGEX_WEIGHTING_MIDDLE}|{REGEX_WEIGHTING_END})$"
175175

176176
DEFAULT_CALORIFIC_VALUE = 40.0
177+
DEFAULT_BOOST_TEMPERATURE_WATER = 50
178+
DEFAULT_BOOST_TEMPERATURE_HEAT = 30
177179

178180
DATA_SCHEMA_ACCOUNT = vol.Schema({
179181
vol.Required(CONFIG_ACCOUNT_ID): str,

custom_components/octopus_energy/coordinators/previous_consumption_and_rates.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ async def async_fetch_consumption_and_rates(
274274
_LOGGER.debug("Dispatches not available for intelligent tariff. Using existing rate information")
275275
return previous_data
276276

277-
if previous_data is not None and previous_data.rates[0]["start"] == period_from and previous_data.rates[-1]["end"] == period_to:
277+
if (previous_data is not None and
278+
previous_data.rates is not None and
279+
len(previous_data.rates) > 0 and
280+
previous_data.rates[0]["start"] == period_from and previous_data.rates[-1]["end"] == period_to):
278281
_LOGGER.info('Previous rates are for our target consumption, so using previously retrieved rates and standing charges')
279282
rate_data = previous_data.rates
280283
standing_charge = { "value_inc_vat": previous_data.standing_charge }
@@ -302,7 +305,10 @@ async def async_fetch_consumption_and_rates(
302305
_LOGGER.error(f"Could not determine tariff code for previous consumption for gas {identifier}/{serial_number}")
303306
return previous_data
304307

305-
if previous_data is not None and previous_data.rates[0]["start"] == period_from and previous_data.rates[-1]["end"] == period_to:
308+
if (previous_data is not None and
309+
previous_data.rates is not None and
310+
len(previous_data.rates) > 0 and
311+
previous_data.rates[0]["start"] == period_from and previous_data.rates[-1]["end"] == period_to):
306312
_LOGGER.info('Previous rates are for our target consumption, so using previously retrieved rates and standing charges')
307313
rate_data = previous_data.rates
308314
standing_charge = { "value_inc_vat": previous_data.standing_charge }

custom_components/octopus_energy/heat_pump/zone.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import logging
33
from typing import List
44

5-
from custom_components.octopus_energy.const import DOMAIN
65
from homeassistant.util.dt import (utcnow)
76
from homeassistant.exceptions import ServiceValidationError
87

@@ -32,6 +31,7 @@
3231
from ..api_client.heat_pump import ConfigurationZone, HeatPump, Sensor, Zone
3332
from ..coordinators.heat_pump_configuration_and_status import HeatPumpCoordinatorResult
3433
from ..api_client import OctopusEnergyApiClient
34+
from ..const import DEFAULT_BOOST_TEMPERATURE_HEAT, DEFAULT_BOOST_TEMPERATURE_WATER, DOMAIN
3535

3636
_LOGGER = logging.getLogger(__name__)
3737

@@ -194,7 +194,18 @@ async def async_set_preset_mode(self, preset_mode):
194194
if self._attr_preset_mode == PRESET_BOOST:
195195
self._end_timestamp = utcnow()
196196
self._end_timestamp += timedelta(hours=1)
197-
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)
197+
198+
boost_temperature = self._attr_target_temperature
199+
if boost_temperature is None:
200+
boost_temperature = DEFAULT_BOOST_TEMPERATURE_WATER if self._zone.configuration.zoneType == "WATER" else DEFAULT_BOOST_TEMPERATURE_HEAT
201+
202+
await self._client.async_boost_heat_pump_zone(
203+
self._account_id,
204+
self._heat_pump_id,
205+
self._zone.configuration.code,
206+
self._end_timestamp,
207+
boost_temperature
208+
)
198209
else:
199210
zone_mode = self.get_zone_mode()
200211
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)
@@ -242,7 +253,18 @@ async def async_boost_heat_pump_zone(self, hours: int, minutes: int, target_temp
242253
self._end_timestamp = utcnow()
243254
self._end_timestamp += timedelta(hours=hours, minutes=minutes)
244255
self._attr_preset_mode = PRESET_BOOST
245-
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)
256+
257+
boost_temperature = target_temperature if target_temperature is not None else self._attr_target_temperature
258+
if boost_temperature is None:
259+
boost_temperature = DEFAULT_BOOST_TEMPERATURE_WATER if self._zone.configuration.zoneType == "WATER" else DEFAULT_BOOST_TEMPERATURE_HEAT
260+
261+
await self._client.async_boost_heat_pump_zone(
262+
self._account_id,
263+
self._heat_pump_id,
264+
self._zone.configuration.code,
265+
self._end_timestamp,
266+
boost_temperature
267+
)
246268

247269
self.async_write_ha_state()
248270

0 commit comments

Comments
 (0)