Skip to content

Commit dc0eeab

Browse files
committed
Make sure _scan_thermostats() is executed when required
1 parent 2c27d7b commit dc0eeab

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

plugwise/helper.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,12 @@ def _cleanup_data(self, data: GwEntityData) -> None:
794794
def _scan_thermostats(self) -> None:
795795
"""Helper-function for smile.py: get_all_entities().
796796
797-
Update locations with thermostat ranking results and use
797+
Adam only: update locations with thermostat ranking results and use
798798
the result to update the device_class of secondary thermostats.
799799
"""
800+
if not self.check_name(ADAM):
801+
return
802+
800803
self._match_and_rank_thermostats()
801804
for location_id, location in self._loc_data.items():
802805
if location["primary_prio"] != 0:
@@ -852,7 +855,11 @@ def _rank_thermostat(
852855
There can be several primary and secondary thermostats per location.
853856
"""
854857
appl_class = entity["dev_class"]
855-
if location_id == entity["location"] and appl_class in thermo_matching:
858+
if (
859+
"location" in entity
860+
and location_id == entity["location"]
861+
and appl_class in thermo_matching
862+
):
856863
# Pre-elect new primary
857864
if thermo_matching[appl_class] == location["primary_prio"]:
858865
location["primary"].append(entity_id)

plugwise/smile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ def get_all_gateway_entities(self) -> None:
114114
if self._is_thermostat:
115115
self.therms_with_offset_func = (
116116
self._get_appliances_with_offset_functionality()
117-
)
118-
if self.check_name(ADAM):
119-
self._scan_thermostats()
117+
)
118+
119+
self._scan_thermostats()
120120

121121
self._get_groups()
122122

0 commit comments

Comments
 (0)