Skip to content

Commit 43f8245

Browse files
committed
Improve logic for select_regulation/gateway_mode
1 parent 07b6329 commit 43f8245

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

plugwise/helper.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,8 @@ def _appliance_measurements(
411411
case "elga_status_code":
412412
data["elga_status_code"] = int(appl_p_loc.text)
413413
case "select_dhw_mode":
414-
data["select_dhw_mode"] = appl_p_loc.text or None
414+
if self._dhw_allowed_modes:
415+
data["select_dhw_mode"] = appl_p_loc.text
415416

416417
common_match_cases(measurement, attrs, appl_p_loc, data)
417418

@@ -537,11 +538,16 @@ def _get_regulation_mode(
537538
538539
Adam: collect the gateway regulation_mode.
539540
"""
540-
if (
541-
mode := self._get_actuator_mode(
542-
appliance, entity_id, "regulation_mode_control_functionality"
543-
)
544-
) is not None:
541+
if self._reg_allowed_modes:
542+
if (
543+
mode := self._get_actuator_mode(
544+
appliance, entity_id, "regulation_mode_control_functionality"
545+
)
546+
) is None:
547+
data["select_regulation_mode"] = None
548+
self._count += 1
549+
return
550+
545551
data["select_regulation_mode"] = mode
546552
self._count += 1
547553
self._cooling_enabled = mode == "cooling"
@@ -553,11 +559,16 @@ def _get_gateway_mode(
553559
554560
Adam: collect the gateway mode.
555561
"""
556-
if (
557-
mode := self._get_actuator_mode(
558-
appliance, entity_id, "gateway_mode_control_functionality"
559-
)
560-
) is not None:
562+
if self._gw_allowed_modes:
563+
if (
564+
mode := self._get_actuator_mode(
565+
appliance, entity_id, "gateway_mode_control_functionality"
566+
)
567+
) is None:
568+
data["select_gateway_mode"] = None
569+
self._count += 1
570+
return
571+
561572
data["select_gateway_mode"] = mode
562573
self._count += 1
563574

0 commit comments

Comments
 (0)