mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-09 06:17:08 +00:00
Fix wifi scan re-querying error (#891)
This commit is contained in:
parent
46338ee21d
commit
3fc131dfd2
@ -512,27 +512,14 @@ class SmartDevice(Device, Bulb, Fan):
|
|||||||
bssid=res["bssid"],
|
bssid=res["bssid"],
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _query_networks(networks=None, start_index=0):
|
_LOGGER.debug("Querying networks")
|
||||||
_LOGGER.debug("Querying networks using start_index=%s", start_index)
|
|
||||||
if networks is None:
|
|
||||||
networks = []
|
|
||||||
|
|
||||||
resp = await self.protocol.query(
|
resp = await self.protocol.query({"get_wireless_scan_info": {"start_index": 0}})
|
||||||
{"get_wireless_scan_info": {"start_index": start_index}}
|
networks = [
|
||||||
)
|
_net_for_scan_info(net) for net in resp["get_wireless_scan_info"]["ap_list"]
|
||||||
network_list = [
|
|
||||||
_net_for_scan_info(net)
|
|
||||||
for net in resp["get_wireless_scan_info"]["ap_list"]
|
|
||||||
]
|
]
|
||||||
networks.extend(network_list)
|
|
||||||
|
|
||||||
if resp["get_wireless_scan_info"].get("sum", 0) > start_index + 10:
|
|
||||||
return await _query_networks(networks, start_index=start_index + 10)
|
|
||||||
|
|
||||||
return networks
|
return networks
|
||||||
|
|
||||||
return await _query_networks()
|
|
||||||
|
|
||||||
async def wifi_join(self, ssid: str, password: str, keytype: str = "wpa2_psk"):
|
async def wifi_join(self, ssid: str, password: str, keytype: str = "wpa2_psk"):
|
||||||
"""Join the given wifi network.
|
"""Join the given wifi network.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user