Skip to content

Commit 505750e

Browse files
committed
Try
1 parent 5150a7d commit 505750e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

plugwise/helper.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ class SmileHelper(SmileCommon):
7373
def __init__(self) -> None:
7474
"""Set the constructor for this class."""
7575
super().__init__()
76+
self._existing_appliances: list[str] = []
77+
self._new_appliances: list[str] = []
7678
self._endpoint: str
7779
self._elga: bool
7880
self._is_thermostat: bool
@@ -93,7 +95,7 @@ def item_count(self) -> int:
9395
"""Return the item-count."""
9496
return self._count
9597

96-
def _all_appliances(self) -> None:
98+
def _all_appliances(self) -> bool:
9799
"""Collect all appliances with relevant info.
98100
99101
Also, collect the P1 smartmeter info from a location
@@ -147,14 +149,23 @@ def _all_appliances(self) -> None:
147149
if not (appl := self._appliance_info_finder(appl, appliance)):
148150
continue
149151

152+
if appl.entity_id in self._existing_appliances:
153+
continue
154+
else:
155+
self._new_appliances.append(appl.entity_id)
156+
150157
self._create_gw_entities(appl)
151158

159+
if not self._new_appliances:
160+
return False
161+
152162
# A smartmeter is not present as an appliance, add it specifically
153163
if self.smile.type == "power" or self.smile.anna_p1:
154164
self._add_p1_smartmeter_info()
155165

156166
# Sort the gw_entities
157167
self._reorder_devices()
168+
return True
158169

159170
def _add_p1_smartmeter_info(self) -> None:
160171
"""For P1 collect the smartmeter info from the Home/building location and add it as an entity.

0 commit comments

Comments
 (0)