New Wi-Fi handling for SMARTCAM devices (#1639)
Some checks failed
CI / Perform Lint Checks (3.13) (push) Has been cancelled
CI / Python 3.11 on macos-latest (push) Has been cancelled
CI / Python 3.12 on macos-latest (push) Has been cancelled
CI / Python 3.13 on macos-latest (push) Has been cancelled
CI / Python 3.11 on ubuntu-latest (push) Has been cancelled
CI / Python 3.12 on ubuntu-latest (push) Has been cancelled
CI / Python 3.13 on ubuntu-latest (push) Has been cancelled
CI / Python 3.11 on windows-latest (push) Has been cancelled
CI / Python 3.12 on windows-latest (push) Has been cancelled
CI / Python 3.13 on windows-latest (push) Has been cancelled
CodeQL Checks / Analyze (python) (push) Has been cancelled

Updated scanning and joining Wi-Fi for SMARTCAM devices that may use a
newer connection process.
This commit is contained in:
ZeliardM
2026-02-21 18:03:52 -05:00
committed by GitHub
parent 494db73fa8
commit 30a8fd45a8
9 changed files with 345 additions and 13 deletions

View File

@@ -6,6 +6,7 @@ import asyncclick as click
from kasa import (
Device,
KasaException,
)
from .common import (
@@ -15,8 +16,7 @@ from .common import (
@click.group()
@pass_dev
def wifi(dev) -> None:
def wifi() -> None:
"""Commands to control wifi settings."""
@@ -35,13 +35,23 @@ async def scan(dev):
@wifi.command()
@click.argument("ssid")
@click.option("--keytype", prompt=True)
@click.option(
"--keytype",
default="",
help="KeyType (Not needed for SmartCamDevice).",
)
@click.option("--password", prompt=True, hide_input=True)
@pass_dev
async def join(dev: Device, ssid: str, password: str, keytype: str):
"""Join the given wifi network."""
echo(f"Asking the device to connect to {ssid}..")
res = await dev.wifi_join(ssid, password, keytype=keytype)
try:
res = await dev.wifi_join(ssid, password, keytype=keytype)
except KasaException as e:
if type(e) is KasaException:
echo(str(e))
return
raise
echo(
f"Response: {res} - if the device is not able to join the network, "
f"it will revert back to its previous state."