Skip to content

Commit 19746aa

Browse files
committed
feat: add networking function
1 parent 17e72c3 commit 19746aa

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_queue import RoborockQueue
@@ -380,7 +381,7 @@ async def get_dock_summary(self, device_id: str, dock_type: RoborockDockType) ->
380381
except RoborockTimeout as e:
381382
_LOGGER.error(e)
382383

383-
async def get_prop(self, device_id: str) -> RoborockDeviceProp:
384+
async def get_prop(self, device_id: str) -> RoborockDeviceProp | None:
384385
[status, dnd_timer, clean_summary, consumable] = await asyncio.gather(
385386
*[
386387
self.get_status(device_id),
@@ -401,6 +402,7 @@ async def get_prop(self, device_id: str) -> RoborockDeviceProp:
401402
return RoborockDeviceProp(
402403
status, dnd_timer, clean_summary, consumable, last_clean_record, dock_summary
403404
)
405+
return None
404406

405407
async def get_multi_maps_list(self, device_id) -> MultiMapsList:
406408
try:
@@ -415,6 +417,14 @@ async def get_multi_maps_list(self, device_id) -> MultiMapsList:
415417
async def get_map_v1(self, device_id):
416418
return await self.send_command(device_id, RoborockCommand.GET_MAP_V1)
417419

420+
async def get_networking(self, device_id) -> NetworkInfo:
421+
try:
422+
networking_info = await self.send_command(device_id, RoborockCommand.GET_NETWORK_INFO)
423+
if isinstance(networking_info, dict):
424+
return NetworkInfo(networking_info)
425+
except RoborockTimeout as e:
426+
_LOGGER.error(e)
427+
418428

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

0 commit comments

Comments
 (0)