Skip to content

Commit d64b02e

Browse files
committed
Improve doc-string, implement suggested breakout function
1 parent fc714e1 commit d64b02e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

plugwise/helper.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,19 +468,22 @@ def _appl_gateway_info(self, appl: Munch, appliance: etree) -> Munch:
468468
def _get_appl_actuator_modes(
469469
self, appliance: etree, actuator_type: str
470470
) -> list[str]:
471-
"""Helper-function for _appliance_info_finder()."""
471+
"""Get allowed modes for the given actuator type."""
472472
mode_list: list[str] = []
473473
if (
474474
search := search_actuator_functionalities(appliance, actuator_type)
475475
) is not None and (modes := search.find("allowed_modes")) is not None:
476476
for mode in modes:
477477
mode_list.append(mode.text)
478-
# Collect cooling_present state from the available regulation_modes
479-
if mode.text == "cooling":
480-
self._cooling_present = True
478+
self._check_cooling_mode(mode.text)
481479

482480
return mode_list
483481

482+
def _check_cooling_mode(self, mode: str) -> None:
483+
"""Check if cooling mode is present and update state."""
484+
if mode == "cooling":
485+
self._cooling_present = True
486+
484487
def _get_appliances_with_offset_functionality(self) -> list[str]:
485488
"""Helper-function collecting all appliance that have offset_functionality."""
486489
therm_list: list[str] = []
@@ -645,7 +648,10 @@ def _get_plugwise_notifications(self) -> None:
645648
def _get_actuator_functionalities(
646649
self, xml: etree, entity: GwEntityData, data: GwEntityData
647650
) -> None:
648-
"""Helper-function for _get_measurement_data()."""
651+
"""Get and process the actuator_functionalities details for an entity.
652+
653+
Add the resulting dict(s) to the entity's data.
654+
"""
649655
for item in ACTIVE_ACTUATORS:
650656
# Skip max_dhw_temperature, not initially valid,
651657
# skip thermostat for all but zones with thermostats

0 commit comments

Comments
 (0)