Skip to content

Commit 27712ad

Browse files
committed
Move PlugwiseData class into backend
1 parent 044fe1c commit 27712ad

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

plugwise/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
ActuatorData,
3636
ApplianceData,
3737
DeviceData,
38-
GatewayData,
38+
PlugwiseData,
3939
SmileBinarySensors,
4040
SmileSensors,
4141
SmileSwitches,
@@ -509,7 +509,7 @@ async def _update_domain_objects(self) -> None:
509509
f"{self._endpoint}{DOMAIN_OBJECTS}",
510510
)
511511

512-
async def async_update(self) -> tuple[GatewayData, dict[str, DeviceData]]:
512+
async def async_update(self) -> PlugwiseData:
513513
"""Perform an incremental update for updating the various device states."""
514514
if self.smile_type != "power":
515515
await self._update_domain_objects()
@@ -549,7 +549,7 @@ async def async_update(self) -> tuple[GatewayData, dict[str, DeviceData]]:
549549
# Update for cooling
550550
self.update_for_cooling(dev_dict)
551551

552-
return (self.gw_data, self.gw_devices)
552+
return PlugwiseData(self.gw_data, self.gw_devices)
553553

554554
async def _set_schedule_state_legacy(
555555
self, loc_id: str, name: str, status: str

plugwise/constants.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections import namedtuple
55
import datetime as dt
66
import logging
7-
from typing import Final, TypedDict
7+
from typing import Final, NamedTuple, TypedDict
88

99
LOGGER = logging.getLogger(__name__)
1010

@@ -504,3 +504,10 @@ class DeviceData(
504504
sensors: SmileSensors
505505
switches: SmileSwitches
506506
thermostat: ActuatorData
507+
508+
509+
class PlugwiseData(NamedTuple):
510+
"""Plugwise data provided as output."""
511+
512+
gateway: GatewayData
513+
devices: dict[str, DeviceData]

0 commit comments

Comments
 (0)