Skip to content

Commit 9c8384c

Browse files
committed
Mypy fixes, clean up
1 parent 18507c9 commit 9c8384c

File tree

2 files changed

+51
-29
lines changed

2 files changed

+51
-29
lines changed

plugwise/__init__.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,28 @@ def __init__(
5858
websession,
5959
)
6060

61-
self._smile_api = None
61+
self._smile_api: SmileAPI | SmileLegacyAPI
6262
self._host = host
6363
self._passwd = password
6464
self._user = username
6565
self._port = port
6666
self._timeout = timeout
67-
self._websession = websession
67+
# self._websession = websession
6868

6969
self._cooling_present = False
70-
self._data: PlugwiseData = {}
7170
self._elga = False
7271
self._is_thermostat = False
7372
self._on_off_device = False
7473
self._opentherm_device = False
75-
self._schedule_old_states = {}
74+
self._schedule_old_states: dict[str, dict[str, str]] = {}
7675
self._stretch_v2 = False
7776
self._stretch_v3 = False
78-
self._target_smile: str | None = None
79-
self.smile_fw_version: str | None = None
80-
self.smile_hostname: str | None = None
77+
self._target_smile: str
78+
self.smile_fw_version: str | None
79+
self.smile_hostname: str
8180
self.smile_hw_version: str | None = None
8281
self.smile_legacy = False
83-
self.smile_mac_address: str | None = None
82+
self.smile_mac_address: str | None
8483
self.smile_model: str
8584
self.smile_name: str
8685
self.smile_type: str
@@ -145,7 +144,7 @@ async def connect(self) -> bool:
145144
self._user,
146145
self._port,
147146
self._timeout,
148-
self._websession,
147+
# self._websession,
149148
)
150149
if self.smile_legacy:
151150
self._smile_api = SmileLegacyAPI(
@@ -170,7 +169,7 @@ async def connect(self) -> bool:
170169
self._user,
171170
self._port,
172171
self._timeout,
173-
self._websession,
172+
# self._websession,
174173
)
175174

176175
# Update all endpoints on first connect
@@ -306,8 +305,7 @@ def get_all_devices(self) -> None:
306305

307306
async def async_update(self) -> PlugwiseData:
308307
"""Perform an incremental update for updating the various device states."""
309-
self._data = await self._smile_api.async_update()
310-
return self._data
308+
return await self._smile_api.async_update()
311309

312310
########################################################################################################
313311
### API Set and HA Service-related Functions ###

plugwise/legacy/smile.py

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
import aiohttp
1010

11-
# Dict as class
1211
from munch import Munch
12+
import semver
1313

1414
# Version detection
1515
from plugwise.constants import (
@@ -41,22 +41,22 @@ def __init__(
4141
self,
4242
host: str,
4343
password: str,
44-
_is_thermostat,
45-
_on_off_device,
46-
_opentherm_device,
47-
_schedule_old_states,
48-
_stretch_v2,
49-
_stretch_v3,
50-
_target_smile,
51-
smile_fw_version,
52-
smile_hostname,
53-
smile_hw_version,
54-
smile_mac_address,
55-
smile_model,
56-
smile_name,
57-
smile_type,
58-
smile_version,
59-
smile_zigbee_mac_address,
44+
_is_thermostat: bool,
45+
_on_off_device: bool,
46+
_opentherm_device: bool,
47+
_schedule_old_states: dict[str, dict[str, str]],
48+
_stretch_v2: bool,
49+
_stretch_v3: bool,
50+
_target_smile: str,
51+
smile_fw_version: str | None,
52+
smile_hostname: str,
53+
smile_hw_version: str | None,
54+
smile_mac_address: str | None,
55+
smile_model: str,
56+
smile_name: str,
57+
smile_type: str,
58+
smile_version: tuple[str, semver.version.Version],
59+
smile_zigbee_mac_address: str | None,
6060
username: str = DEFAULT_USERNAME,
6161
port: int = DEFAULT_PORT,
6262
timeout: float = DEFAULT_TIMEOUT,
@@ -255,3 +255,27 @@ async def _set_groupswitch_member_state(
255255
data = f"<{switch.func_type}><{switch.func}>{state}</{switch.func}></{switch.func_type}>"
256256

257257
await self._request(uri, method="put", data=data)
258+
259+
async def set_number_setpoint(self, key: str, temperature: float) -> None:
260+
"""Set the max. Boiler or DHW setpoint on the Central Heating boiler."""
261+
pass
262+
263+
async def set_temperature_offset(self, dev_id: str, offset: float) -> None:
264+
"""Set the Temperature offset for thermostats that support this feature."""
265+
pass
266+
267+
async def set_gateway_mode(self, mode: str) -> None:
268+
"""Set the gateway mode."""
269+
pass
270+
271+
async def set_regulation_mode(self, mode: str) -> None:
272+
"""Set the heating regulation mode."""
273+
pass
274+
275+
async def set_dhw_mode(self, mode: str) -> None:
276+
"""Set the domestic hot water heating regulation mode."""
277+
pass
278+
279+
async def delete_notification(self) -> None:
280+
"""Delete the active Plugwise Notification."""
281+
pass

0 commit comments

Comments
 (0)