Skip to content

Commit 3135101

Browse files
committed
Combine cases for only appliances
1 parent 538b096 commit 3135101

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

plugwise/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
MIN_SETPOINT,
2626
MODULES,
2727
NOTIFICATIONS,
28+
REQUIRE_APPLIANCES,
2829
RULES,
2930
SMILES,
3031
STATUS,
@@ -511,12 +512,10 @@ async def async_update(self) -> PlugwiseData:
511512
self._modules = await self._request(MODULES)
512513
case "smile_v3" | "smile_v4":
513514
self._locations = await self._request(LOCATIONS)
514-
case "smile_thermo_v1" | "smile_thermo_v3" | "smile_thermo_v4":
515-
self._appliances = await self._request(APPLIANCES)
516515
case "smile_open_therm_v2" | "smile_open_therm_v3":
517516
self._appliances = await self._request(APPLIANCES)
518517
self._modules = await self._request(MODULES)
519-
case "stretch_v2" | "stretch_v3":
518+
case self._target_smile if self._target_smile in REQUIRE_APPLIANCES:
520519
self._appliances = await self._request(APPLIANCES)
521520

522521
self.gw_data["notifications"] = self._notifications

plugwise/constants.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,13 @@
200200
"stretch_v2": SMILE("stretch", "Stretch"),
201201
"stretch_v3": SMILE("stretch", "Stretch"),
202202
}
203+
REQUIRE_APPLIANCES: Final[list[str]] = [
204+
"smile_thermo_v1",
205+
"smile_thermo_v3",
206+
"smile_thermo_v4",
207+
"stretch_v2",
208+
"stretch_v3",
209+
]
203210

204211
# Class, Literal and related tuple-definitions
205212

0 commit comments

Comments
 (0)