Skip to content

Commit fac1de5

Browse files
authored
Merge pull request #353 from plugwise/p1v2-fail
Improvements
2 parents 0804cf9 + 6e9825c commit fac1de5

File tree

4 files changed

+10
-29
lines changed

4 files changed

+10
-29
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- Correct non-unique device names in adam_jip userdata
77
- Add domestic_hot_water_setpoint data to anna_heatpump_heating userdata, update relevant test-cases
88
- Add raising an error when providing the wrong type of temperature input to set_temperature() with cooling active
9+
- Add preliminary support for python 3.12 by updating build system requirements
10+
- Code improvements
911

1012
## V0.31.6: Fix domestic_hot_water_setpoint-related bug for Anna + Elga
1113

plugwise/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
DEFAULT_TIMEOUT,
2020
DEFAULT_USERNAME,
2121
DOMAIN_OBJECTS,
22-
LEGACY_SMILES,
2322
LOCATIONS,
2423
LOGGER,
2524
MAX_SETPOINT,
@@ -389,7 +388,6 @@ async def _smile_detect_legacy(
389388
network = zb_network.find("./master_controller")
390389
self.smile_zigbee_mac_address = network.find("mac_address").text
391390

392-
self._smile_legacy = True
393391
# Legacy Anna or Stretch:
394392
if (
395393
result.find('./appliance[type="thermostat"]') is not None
@@ -421,6 +419,7 @@ async def _smile_detect_legacy(
421419
)
422420
raise ResponseError
423421

422+
self._smile_legacy = True
424423
return model
425424

426425
async def _smile_detect(self, result: etree, dsmrmain: etree) -> None:
@@ -463,9 +462,6 @@ async def _smile_detect(self, result: etree, dsmrmain: etree) -> None:
463462
self.smile_type = SMILES[target_smile].smile_type
464463
self.smile_version = (self.smile_fw_version, ver)
465464

466-
if target_smile in LEGACY_SMILES:
467-
self._smile_legacy = True
468-
469465
if self.smile_type == "stretch":
470466
self._stretch_v2 = self.smile_version[1].major == 2
471467
self._stretch_v3 = self.smile_version[1].major == 3

plugwise/constants.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@
9898
"070051": "Switch",
9999
"080029": "Switch",
100100
}
101-
LEGACY_SMILES: Final[tuple[str, ...]] = (
102-
"smile_thermo_v1",
103-
"smile_v2",
104-
"stretch_v2",
105-
"stretch_v3",
106-
)
107101
LIMITS: Final[tuple[str, ...]] = (
108102
"setpoint",
109103
"lower_bound",

plugwise/helper.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -395,27 +395,12 @@ def __init__(self) -> None:
395395
self.smile_version: tuple[str, semver.version.Version]
396396
self.smile_zigbee_mac_address: str | None = None
397397

398-
def _locations_specials(self, loc: Munch, location: str) -> Munch:
399-
"""Helper-function for _all_locations().
400-
401-
Correct location info in special cases.
402-
"""
403-
if loc.name == "Home":
404-
self._home_location = loc.loc_id
405-
406-
# Replace location-name for P1 legacy, can contain privacy-related info
407-
if self._smile_legacy and self.smile_type == "power":
408-
loc.name = "Home"
409-
self._home_location = loc.loc_id
410-
411-
return loc
412-
413398
def _all_locations(self) -> None:
414399
"""Collect all locations."""
415400
loc = Munch()
416401

417-
# Legacy Anna without outdoor_temp and Stretches have no locations, create one containing all appliances
418402
locations = self._locations.findall("./location")
403+
# Legacy Anna without outdoor_temp and Stretches have no locations, create fake location-data
419404
if not locations and self._smile_legacy:
420405
self._home_location = FAKE_LOC
421406
self._loc_data[FAKE_LOC] = {"name": "Home"}
@@ -433,8 +418,12 @@ def _all_locations(self) -> None:
433418
):
434419
continue
435420

436-
# Specials
437-
loc = self._locations_specials(loc, location)
421+
if loc.name == "Home":
422+
self._home_location = loc.loc_id
423+
# Replace location-name for P1 legacy, can contain privacy-related info
424+
if self._smile_legacy and self.smile_type == "power":
425+
loc.name = "Home"
426+
self._home_location = loc.loc_id
438427

439428
self._loc_data[loc.loc_id] = {"name": loc.name}
440429

0 commit comments

Comments
 (0)