Skip to content

Commit fc32177

Browse files
committed
Break out _appl_dhw_mode_info() function
1 parent dd03a01 commit fc32177

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

plugwise/helper.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -336,17 +336,10 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch:
336336
if appl.pwclass in THERMOSTAT_CLASSES:
337337
return self._appl_thermostat_info(appl, appliance)
338338

339-
# Collect extra heater_central device info
339+
# Collect heater_central device info
340340
if appl.pwclass == "heater_central":
341341
appl = self._appl_heater_central_info(appl, appliance)
342-
# Anna + Loria: collect dhw control operation modes
343-
dhw_mode_list: list[str] = []
344-
locator = "./actuator_functionalities/domestic_hot_water_mode_control_functionality"
345-
if (search := appliance.find(locator)) is not None:
346-
if search.find("allowed_modes") is not None:
347-
for mode in search.find("allowed_modes"):
348-
dhw_mode_list.append(mode.text)
349-
self._dhw_allowed_modes = dhw_mode_list
342+
appl = self._appl_dhw_mode_info(appl, appliance)
350343

351344
return appl
352345

@@ -355,6 +348,18 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch:
355348

356349
return appl
357350

351+
def _appl_dhw_mode_info(self, appl: Munch, appliance: etree) -> Munch:
352+
"""Collect dhw control operation modes - Anna + Loria."""
353+
dhw_mode_list: list[str] = []
354+
locator = "./actuator_functionalities/domestic_hot_water_mode_control_functionality"
355+
if (search := appliance.find(locator)) is not None:
356+
if search.find("allowed_modes") is not None:
357+
for mode in search.find("allowed_modes"):
358+
dhw_mode_list.append(mode.text)
359+
self._dhw_allowed_modes = dhw_mode_list
360+
361+
return appl
362+
358363
def _p1_smartmeter_info_finder(self, appl: Munch) -> None:
359364
"""Collect P1 DSMR Smartmeter info."""
360365
loc_id = next(iter(self.loc_data.keys()))

0 commit comments

Comments
 (0)