Skip to content

Commit

Permalink
Better handling of cylinder boost in water heater entity
Browse files Browse the repository at this point in the history
  • Loading branch information
signalkraft committed Feb 9, 2024
1 parent 0f479d9 commit 2d87cc4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion custom_components/mypyllant/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/signalkraft/mypyllant-component/issues",
"requirements": [
"myPyllant==0.7.10"
"myPyllant==0.7.11"
],
"version": "v0.7.3"
}
6 changes: 1 addition & 5 deletions custom_components/mypyllant/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
HolidayEntity,
DomesticHotWaterCoordinatorEntity,
)
from myPyllant.enums import DHWCurrentSpecialFunction, DHWCurrentSpecialFunctionVRC700
from myPyllant.utils import get_default_holiday_dates

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -77,10 +76,7 @@ def name(self):

@property
def is_on(self):
return self.domestic_hot_water.current_special_function in [
DHWCurrentSpecialFunction.CYLINDER_BOOST,
DHWCurrentSpecialFunctionVRC700.CYLINDER_BOOST,
]
return self.domestic_hot_water.is_cylinder_boosting

async def async_turn_on(self, **kwargs):
await self.coordinator.api.boost_domestic_hot_water(
Expand Down
19 changes: 8 additions & 11 deletions custom_components/mypyllant/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ def __init__(self, system_index, dhw_index, coordinator) -> None:
def operation_list(self):
if self.domestic_hot_water.control_identifier.is_vrc700:
return [d.display_value for d in DHWOperationModeVRC700] + [
DHWCurrentSpecialFunction.CYLINDER_BOOST.display_value
DHWCurrentSpecialFunctionVRC700.CYLINDER_BOOST.display_value
]
else:
return [d.display_value for d in DHWOperationMode] + [
DHWCurrentSpecialFunctionVRC700.CYLINDER_BOOST.display_value
DHWCurrentSpecialFunction.CYLINDER_BOOST.display_value
]

@property
Expand Down Expand Up @@ -168,10 +168,7 @@ def max_temp(self) -> float:

@property
def current_operation(self) -> str:
if (
self.domestic_hot_water.current_special_function
== DHWCurrentSpecialFunction.CYLINDER_BOOST
):
if self.domestic_hot_water.is_cylinder_boosting:
return str(DHWCurrentSpecialFunction.CYLINDER_BOOST.display_value)
return str(self.domestic_hot_water.operation_mode_dhw.display_value)

Expand All @@ -186,15 +183,15 @@ async def async_set_operation_mode(
self, operation_mode: str, **kwargs: Any
) -> None:
enum_value = operation_mode.upper().replace(" ", "_")
if enum_value == str(DHWCurrentSpecialFunction.CYLINDER_BOOST):
if enum_value in [
str(DHWCurrentSpecialFunction.CYLINDER_BOOST),
str(DHWCurrentSpecialFunctionVRC700.CYLINDER_BOOST),
]:
# Boost was requested
await self.coordinator.api.boost_domestic_hot_water(
self.domestic_hot_water,
)
elif (
self.domestic_hot_water.current_special_function
== DHWCurrentSpecialFunction.CYLINDER_BOOST
):
elif self.domestic_hot_water.is_cylinder_boosting:
# Something other than boost was requested, but boost mode is currently active
await self.coordinator.api.cancel_hot_water_boost(
self.domestic_hot_water,
Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ types-PyYAML~=6.0.12.12
pytest==7.4.3
pytest-cov==4.1.0
pytest-homeassistant-custom-component==0.13.77
myPyllant==0.7.10
myPyllant==0.7.11
dacite~=1.7.0

0 comments on commit 2d87cc4

Please sign in to comment.