Skip to content

Commit 5a9e17b

Browse files
committed
Improve _sort_gw_entities(), partly following suggestion
1 parent fa40c50 commit 5a9e17b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plugwise/helper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,11 @@ def _sort_gw_entities(self) -> None:
359359
for dev_class in ("heater_central", "gateway"):
360360
for entity_id, entity in dict(self.gw_entities).items():
361361
if entity["dev_class"] == dev_class:
362-
tmp_entity = entity
362+
priority_entity = entity
363363
self.gw_entities.pop(entity_id)
364-
cleared_dict = self.gw_entities
365-
add_to_front = {entity_id: tmp_entity}
366-
self.gw_entities = {**add_to_front, **cleared_dict}
364+
other_entities = self.gw_entities
365+
priority_entities = {entity_id: priority_entity}
366+
self.gw_entities = {**priority_entities, **other_entities}
367367

368368
def _all_locations(self) -> None:
369369
"""Collect all locations."""

0 commit comments

Comments
 (0)