Skip to content

Commit f489121

Browse files
committed
Move Adam-related under one if
1 parent cd693e6 commit f489121

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

plugwise/helper.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -323,20 +323,19 @@ def _appl_gateway_info(self, appl: Munch, appliance: etree) -> Munch:
323323
appl.vendor_name = "Plugwise"
324324

325325
# Adam: collect the ZigBee MAC address of the Smile
326-
if self.smile(ADAM) and (
327-
(found := self._domain_objects.find(".//protocols/zig_bee_coordinator")) is not None
328-
):
329-
appl.zigbee_mac = found.find("mac_address").text
330-
331-
# Adam: collect regulation_modes and check for cooling, indicating cooling-mode is present
332-
self._appl_regulation_mode_info(appliance)
333-
334-
# Adam: collect the gateway_modes
335-
self._gw_allowed_modes = []
336-
locator = "./actuator_functionalities/gateway_mode_control_functionality[type='gateway_mode']/allowed_modes"
337-
if appliance.find(locator) is not None:
338-
# Limit the possible gateway-modes
339-
self._gw_allowed_modes = ["away", "full", "vacation"]
326+
if self.smile(ADAM):
327+
if (found := self._domain_objects.find(".//protocols/zig_bee_coordinator")) is not None:
328+
appl.zigbee_mac = found.find("mac_address").text
329+
330+
# Also, collect regulation_modes and check for cooling, indicating cooling-mode is present
331+
self._appl_regulation_mode_info(appliance)
332+
333+
# Finally, collect the gateway_modes
334+
self._gw_allowed_modes = []
335+
locator = "./actuator_functionalities/gateway_mode_control_functionality[type='gateway_mode']/allowed_modes"
336+
if appliance.find(locator) is not None:
337+
# Limit the possible gateway-modes
338+
self._gw_allowed_modes = ["away", "full", "vacation"]
340339

341340
return appl
342341

0 commit comments

Comments
 (0)