Skip to content

Commit 42bcfe8

Browse files
committed
Add SmileCommon property heater_id, Smile/Legacy property cooling_present
1 parent 3536622 commit 42bcfe8

File tree

6 files changed

+22
-11
lines changed

6 files changed

+22
-11
lines changed

plugwise/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ def __init__(
8686
@property
8787
def cooling_present(self) -> bool:
8888
"""Return the cooling capability."""
89-
if "cooling_present" in self._smile_props:
90-
return self._smile_props["cooling_present"]
91-
return False
89+
return self._smile_api.cooling_present
9290

9391
@property
9492
def gateway_id(self) -> str:
@@ -98,9 +96,7 @@ def gateway_id(self) -> str:
9896
@property
9997
def heater_id(self) -> str:
10098
"""Return the heater-id."""
101-
if "heater_id" in self._smile_props:
102-
return self._smile_props["heater_id"]
103-
return NONE
99+
return self._smile_api.heater_id
104100

105101
@property
106102
def item_count(self) -> int:

plugwise/common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ def __init__(self) -> None:
5858
self.smile_name: str
5959
self.smile_type: str
6060

61+
@property
62+
def heater_id(self) -> str:
63+
"""Return the heater-id."""
64+
return self._heater_id
65+
6166
def smile(self, name: str) -> bool:
6267
"""Helper-function checking the smile-name."""
6368
return self.smile_name == name

plugwise/helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree.Element) -> Munch
233233
appliance, "domestic_hot_water_mode_control_functionality"
234234
)
235235
# Skip orphaned heater_central (Core Issue #104433)
236-
if appl.entity_id != self._heater_id:
236+
if appl.entity_id != self.heater_id:
237237
return Munch()
238238
return appl
239239
case _ as s if s.endswith("_plug"):
@@ -344,7 +344,7 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData:
344344

345345
# Get non-P1 data from APPLIANCES
346346
measurements = DEVICE_MEASUREMENTS
347-
if self._is_thermostat and entity_id == self._heater_id:
347+
if self._is_thermostat and entity_id == self.heater_id:
348348
measurements = HEATER_CENTRAL_MEASUREMENTS
349349
# Show the allowed dhw_modes (Loria only)
350350
if self._dhw_allowed_modes:
@@ -619,7 +619,7 @@ def _update_anna_cooling(self, entity_id: str, data: GwEntityData) -> None:
619619
620620
Support added for Techneco Elga and Thercon Loria/Thermastage.
621621
"""
622-
if entity_id != self._heater_id:
622+
if entity_id != self.heater_id:
623623
return
624624

625625
if "elga_status_code" in data:

plugwise/legacy/helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _all_appliances(self) -> None:
125125
continue
126126

127127
# Skip orphaned heater_central (Core Issue #104433)
128-
if appl.pwclass == "heater_central" and appl.entity_id != self._heater_id:
128+
if appl.pwclass == "heater_central" and appl.entity_id != self.heater_id:
129129
continue # pragma: no cover
130130

131131
self._create_gw_entities(appl)
@@ -268,7 +268,7 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData:
268268
return data
269269

270270
measurements = DEVICE_MEASUREMENTS
271-
if self._is_thermostat and entity_id == self._heater_id:
271+
if self._is_thermostat and entity_id == self.heater_id:
272272
measurements = HEATER_CENTRAL_MEASUREMENTS
273273

274274
if (

plugwise/legacy/smile.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ def __init__(
7676
self._first_update = True
7777
self._previous_day_number: str = "0"
7878

79+
@property
80+
def cooling_present(self) -> bool:
81+
"""Return the cooling capability."""
82+
return False
83+
7984
async def full_xml_update(self) -> None:
8085
"""Perform a first fetch of the Plugwise server XML data."""
8186
self._domain_objects = await self._request(DOMAIN_OBJECTS)

plugwise/smile.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ def __init__(
8383
self.smile_version = smile_version
8484
self.therms_with_offset_func: list[str] = []
8585

86+
@property
87+
def cooling_present(self) -> bool:
88+
"""Return the cooling capability."""
89+
return self._cooling_present
90+
8691
async def full_xml_update(self) -> None:
8792
"""Perform a first fetch of the Plugwise server XML data."""
8893
self._domain_objects = await self._request(DOMAIN_OBJECTS)

0 commit comments

Comments
 (0)