Skip to content

Commit 17a8e99

Browse files
committed
Make sure _scan_thermostats() is executed when required
1 parent a11a845 commit 17a8e99

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
@@ -792,9 +792,12 @@ def _cleanup_data(self, data: GwEntityData) -> None:
792792
def _scan_thermostats(self) -> None:
793793
"""Helper-function for smile.py: get_all_entities().
794794
795-
Update locations with thermostat ranking results and use
795+
Adam only: update locations with thermostat ranking results and use
796796
the result to update the device_class of secondary thermostats.
797797
"""
798+
if not self.check_name(ADAM):
799+
return
800+
798801
self._match_and_rank_thermostats()
799802
for location_id, location in self._loc_data.items():
800803
if location["primary_prio"] != 0:
@@ -850,7 +853,11 @@ def _rank_thermostat(
850853
There can be several primary and secondary thermostats per location.
851854
"""
852855
appl_class = entity["dev_class"]
853-
if location_id == entity["location"] and appl_class in thermo_matching:
856+
if (
857+
"location" in entity
858+
and location_id == entity["location"]
859+
and appl_class in thermo_matching
860+
):
854861
# Pre-elect new primary
855862
if thermo_matching[appl_class] == location["primary_prio"]:
856863
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)