Skip to content

Commit 2126ce2

Browse files
Merge pull request #24 from Lash-L/networking_function
feat: add networking function
2 parents ad3afc0 + 19746aa commit 2126ce2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

roborock/api.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
RoborockDeviceInfo,
3939
WashTowelMode,
4040
DustCollectionMode,
41+
NetworkInfo,
4142

4243
)
4344
from .roborock_message import RoborockMessage
@@ -286,7 +287,7 @@ async def get_dock_summary(self, device_id: str, dock_type: RoborockDockType) ->
286287
except RoborockTimeout as e:
287288
_LOGGER.error(e)
288289

289-
async def get_prop(self, device_id: str) -> RoborockDeviceProp:
290+
async def get_prop(self, device_id: str) -> RoborockDeviceProp | None:
290291
[status, dnd_timer, clean_summary, consumable] = await asyncio.gather(
291292
*[
292293
self.get_status(device_id),
@@ -307,6 +308,7 @@ async def get_prop(self, device_id: str) -> RoborockDeviceProp:
307308
return RoborockDeviceProp(
308309
status, dnd_timer, clean_summary, consumable, last_clean_record, dock_summary
309310
)
311+
return None
310312

311313
async def get_multi_maps_list(self, device_id) -> MultiMapsList:
312314
try:
@@ -321,6 +323,14 @@ async def get_multi_maps_list(self, device_id) -> MultiMapsList:
321323
async def get_map_v1(self, device_id):
322324
return await self.send_command(device_id, RoborockCommand.GET_MAP_V1)
323325

326+
async def get_networking(self, device_id) -> NetworkInfo:
327+
try:
328+
networking_info = await self.send_command(device_id, RoborockCommand.GET_NETWORK_INFO)
329+
if isinstance(networking_info, dict):
330+
return NetworkInfo(networking_info)
331+
except RoborockTimeout as e:
332+
_LOGGER.error(e)
333+
324334

325335
class RoborockApiClient:
326336
def __init__(self, username: str, base_url=None) -> None:

0 commit comments

Comments
 (0)