Skip to content

Commit aae098d

Browse files
committed
Merge DeviceDataPoints into DeviceData class, adapt
1 parent c94910f commit aae098d

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

plugwise/constants.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -751,10 +751,8 @@ class ActuatorData(TypedDict, total=False):
751751
upper_bound: float
752752

753753

754-
class DeviceDataPoints(
755-
SmileBinarySensors, SmileSensors, SmileSwitches, TypedDict, total=False
756-
):
757-
"""The class covering all possible collected data points."""
754+
class DeviceData(ApplianceData, TypedDict, total=False):
755+
"""The Device Data class, covering the collected and ordere output-data per device."""
758756

759757
# Loria
760758
dhw_mode: str
@@ -784,10 +782,6 @@ class DeviceDataPoints(
784782
# Device availability
785783
available: bool | None
786784

787-
788-
class DeviceData(ApplianceData, DeviceDataPoints, TypedDict, total=False):
789-
"""The Device Data class, covering the collected and ordere output-data per device."""
790-
791785
binary_sensors: SmileBinarySensors
792786
domestic_hot_water_setpoint: ActuatorData | float
793787
maximum_boiler_temperature: ActuatorData | float

plugwise/helper.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import asyncio
88
import datetime as dt
9-
from typing import cast
109

1110
# This way of importing aiohttp is because of patch/mocking in testing (aiohttp timeouts)
1211
from aiohttp import BasicAuth, ClientError, ClientResponse, ClientSession, ClientTimeout
@@ -52,7 +51,6 @@
5251
ActuatorData,
5352
ApplianceData,
5453
DeviceData,
55-
DeviceDataPoints,
5654
GatewayData,
5755
ModelData,
5856
SmileBinarySensors,
@@ -77,7 +75,7 @@
7775

7876

7977
def update_helper(
80-
data: DeviceDataPoints,
78+
data: DeviceData,
8179
devices: dict[str, DeviceData],
8280
device_dict: DeviceData,
8381
device_id: str,
@@ -1481,7 +1479,7 @@ def _get_toggle_state(
14811479
def _update_device_with_dicts(
14821480
self,
14831481
d_id: str,
1484-
data: DeviceDataPoints,
1482+
data: DeviceData,
14851483
device_in: ApplianceData,
14861484
bs_dict: SmileBinarySensors,
14871485
s_dict: SmileSensors,
@@ -1519,7 +1517,6 @@ def _update_device_with_dicts(
15191517
):
15201518
bs_dict["plugwise_notification"] = False
15211519

1522-
data = cast(DeviceData, data)
15231520
device_out.update(data)
15241521
if bs_dict:
15251522
device_out["binary_sensors"] = bs_dict

plugwise/smile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
ActuatorData,
3636
ApplianceData,
3737
DeviceData,
38-
DeviceDataPoints,
3938
GatewayData,
4039
SmileBinarySensors,
4140
SmileSensors,
@@ -265,7 +264,7 @@ def _check_availability(
265264
if "P1 does not seem to be connected to a smart meter" in msg:
266265
device_data["available"] = False
267266

268-
def _get_device_data(self, dev_id: str) -> DeviceDataPoints:
267+
def _get_device_data(self, dev_id: str) -> DeviceData:
269268
"""
270269
Helper-function for _all_device_data() and async_update().
271270

0 commit comments

Comments
 (0)