Skip to content

Commit d509659

Browse files
committed
Reduce complexity 3
1 parent c3a35d8 commit d509659

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

plugwise/helper.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,7 @@ def _get_measurement_data(self, dev_id: str) -> DeviceZoneData:
531531
for toggle, name in TOGGLES.items():
532532
self._get_toggle_state(appliance, toggle, name, data)
533533

534-
if appliance.find("type").text in ACTUATOR_CLASSES:
535-
self._get_actuator_functionalities(appliance, device, data)
534+
self._get_actuator_functionalities(appliance, device, data)
536535

537536
if dev_id == self.gateway_id and self.smile(ADAM):
538537
self._get_regulation_mode(appliance, data)
@@ -546,7 +545,8 @@ def _get_measurement_data(self, dev_id: str) -> DeviceZoneData:
546545
data.pop("c_heating_state")
547546
self._count -= 1
548547

549-
self._update_anna_cooling(dev_id, data)
548+
if self._is_thermostat and self.smile(ANNA):
549+
self._update_anna_cooling(dev_id, data)
550550

551551
def _power_data_from_location(self, loc_id: str) -> DeviceZoneData:
552552
"""Helper-function for smile.py: _get_device_zone_data().
@@ -640,6 +640,9 @@ def _get_actuator_functionalities(
640640
self, xml: etree, device: DeviceZoneData, data: DeviceZoneData
641641
) -> None:
642642
"""Helper-function for _get_measurement_data()."""
643+
if appliance.find("type").text not in ACTUATOR_CLASSES:
644+
continue
645+
643646
for item in ACTIVE_ACTUATORS:
644647
# Skip max_dhw_temperature, not initially valid,
645648
# skip thermostat for all but zones with thermostats
@@ -746,7 +749,7 @@ def _process_c_heating_state(self, data: DeviceZoneData) -> None:
746749
"""
747750
# Adam or Anna + OnOff device
748751
if self._on_off_device:
749-
self._process_on_off_device_c_heating_state(self, data)
752+
self._process_on_off_device_c_heating_state(data)
750753

751754
# Anna + Elga: use central_heating_state to show heating_state
752755
if self._elga:
@@ -777,7 +780,7 @@ def _update_anna_cooling(self, dev_id: str, data: DeviceZoneData) -> None:
777780
778781
Support added for Techneco Elga and Thercon Loria/Thermastage.
779782
"""
780-
if self._is_thermostat and self.smile(ANNA) and dev_id == self._heater_id:
783+
if dev_id == self._heater_id:
781784
# Anna+Elga: base cooling_state on the elga-status-code
782785
if "elga_status_code" in data:
783786
if data["thermostat_supports_cooling"]:

0 commit comments

Comments
 (0)