mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-10 23:07:08 +00:00
Re-initialize children after pairing/unpairing
This commit is contained in:
parent
2f669f5ad7
commit
1a758a6a53
@ -7,15 +7,18 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
# hen support for cpython older than 3.11 is dropped
|
# hen support for cpython older than 3.11 is dropped
|
||||||
# async_timeout can be replaced with asyncio.timeout
|
# async_timeout can be replaced with asyncio.timeout
|
||||||
from async_timeout import timeout as asyncio_timeout
|
from async_timeout import timeout as asyncio_timeout
|
||||||
|
|
||||||
from ...feature import Feature
|
from ...feature import Feature
|
||||||
from ..smartdevice import SmartDevice
|
|
||||||
from ..smartmodule import SmartModule
|
from ..smartmodule import SmartModule
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..smartdevice import SmartDevice
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -73,11 +76,15 @@ class ChildSetupModule(SmartModule):
|
|||||||
async def unpair(self, device_id: str):
|
async def unpair(self, device_id: str):
|
||||||
"""Remove device from the hub."""
|
"""Remove device from the hub."""
|
||||||
payload = {"child_device_list": [{"device_id": device_id}]}
|
payload = {"child_device_list": [{"device_id": device_id}]}
|
||||||
return await self._device._query_helper("remove_child_device_list", payload)
|
res = await self._device._query_helper("remove_child_device_list", payload)
|
||||||
|
await self._device._initialize_children()
|
||||||
|
return res
|
||||||
|
|
||||||
async def add_devices(self, devices: dict):
|
async def add_devices(self, devices: dict):
|
||||||
"""Add devices."""
|
"""Add devices."""
|
||||||
return await self._device._query_helper("add_child_device_list", devices)
|
res = await self._device._query_helper("add_child_device_list", devices)
|
||||||
|
await self._device._initialize_children()
|
||||||
|
return res
|
||||||
|
|
||||||
async def get_detected_devices(self) -> dict:
|
async def get_detected_devices(self) -> dict:
|
||||||
"""Return list of devices detected during scanning."""
|
"""Return list of devices detected during scanning."""
|
||||||
|
Loading…
Reference in New Issue
Block a user