44
55import asyncio
66import logging
7- from typing import Optional , Tuple , Any , Dict
7+ from typing import Optional , Tuple , Any
88
99import aiohttp
1010from getmac import get_mac_address
1111
1212
1313from pooldose .constants import get_default_device_info
14+ from pooldose .type_definitions import DeviceInfoDict , StructuredValuesDict , APIVersionResponse
1415from pooldose .mappings .mapping_info import MappingInfo
1516from pooldose .request_handler import RequestHandler
1617from pooldose .request_status import RequestStatus
1718from pooldose .values .instant_values import InstantValues
1819from pooldose .values .static_values import StaticValues
1920
20- # pylint: disable=line-too-long,too-many-instance-attributes
21+ # pylint: disable=line-too-long,too-many-instance-attributes, line-too-long
2122
2223_LOGGER = logging .getLogger (__name__ )
2324
@@ -58,7 +59,7 @@ def __init__(self, host: str, timeout: int = 30, *, websession: Optional[aiohttp
5859 self ._request_handler : RequestHandler | None = None
5960
6061 # Initialize device info with default or placeholder values
61- self .device_info : Dict [ str , Any ] = get_default_device_info ()
62+ self .device_info : DeviceInfoDict = get_default_device_info ()
6263
6364 # Mapping-Status und Mapping-Cache
6465 self ._mapping_status = None
@@ -103,13 +104,13 @@ def request_handler(self) -> RequestHandler:
103104 raise RuntimeError ("Client not connected. Call connect() first." )
104105 return self ._request_handler
105106
106- def check_apiversion_supported (self ) -> Tuple [RequestStatus , Dict [ str , Optional [ str ]] ]:
107+ def check_apiversion_supported (self ) -> Tuple [RequestStatus , APIVersionResponse ]:
107108 """
108109 Check if the loaded API version matches the supported version.
109110
110111 Returns:
111- tuple: (RequestStatus, dict )
112- - dict contains:
112+ tuple: (RequestStatus, APIVersionResponse )
113+ - APIVersionResponse contains:
113114 "api_version_is": the current API version (or None if not set)
114115 "api_version_should": the expected API version
115116 - RequestStatus.NO_DATA if not set.
@@ -120,7 +121,7 @@ def check_apiversion_supported(self) -> Tuple[RequestStatus, Dict[str, Optional[
120121 "api_version_should" : API_VERSION_SUPPORTED ,
121122 }
122123
123- result = {
124+ result : APIVersionResponse = {
124125 "api_version_is" : self ._request_handler .api_version ,
125126 "api_version_should" : API_VERSION_SUPPORTED ,
126127 }
@@ -233,7 +234,7 @@ def static_values(self) -> tuple[RequestStatus, StaticValues | None]:
233234 tuple: (RequestStatus, StaticValues|None) - Status and static values object.
234235 """
235236 try :
236- # Device info is already Dict[str, Any]
237+ # Device info is DeviceInfoDict and StaticValues now accepts it directly
237238 return RequestStatus .SUCCESS , StaticValues (self .device_info )
238239 except (ValueError , TypeError , KeyError ) as err :
239240 _LOGGER .warning ("Error creating StaticValues: %s" , err )
@@ -270,12 +271,12 @@ async def instant_values(self) -> tuple[RequestStatus, InstantValues | None]:
270271 _LOGGER .warning ("Error creating InstantValues: %s" , err )
271272 return RequestStatus .UNKNOWN_ERROR , None
272273
273- async def instant_values_structured (self ) -> Tuple [RequestStatus , Dict [ str , Any ] ]:
274+ async def instant_values_structured (self ) -> Tuple [RequestStatus , StructuredValuesDict ]:
274275 """
275276 Get instant values in structured JSON format with types as top-level keys.
276277
277278 Returns:
278- Tuple[RequestStatus, Dict[str, Any] ]: Status and structured data dict.
279+ Tuple[RequestStatus, StructuredValuesDict ]: Status and structured data dict.
279280 """
280281 # Get instant values object
281282 status , instant_values = await self .instant_values ()
0 commit comments