mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-07 19:24:01 +00:00
Add smartcam child device support for smartcam hubs (#1413)
This commit is contained in:
@@ -60,11 +60,19 @@ SUPPORTED_SMARTCAM_DEVICES = [
|
||||
)
|
||||
]
|
||||
|
||||
SUPPORTED_SMARTCAM_CHILD_DEVICES = [
|
||||
(device, "SMARTCAM.CHILD")
|
||||
for device in glob.glob(
|
||||
os.path.dirname(os.path.abspath(__file__)) + "/fixtures/smartcam/child/*.json"
|
||||
)
|
||||
]
|
||||
|
||||
SUPPORTED_DEVICES = (
|
||||
SUPPORTED_IOT_DEVICES
|
||||
+ SUPPORTED_SMART_DEVICES
|
||||
+ SUPPORTED_SMART_CHILD_DEVICES
|
||||
+ SUPPORTED_SMARTCAM_DEVICES
|
||||
+ SUPPORTED_SMARTCAM_CHILD_DEVICES
|
||||
)
|
||||
|
||||
|
||||
@@ -82,14 +90,8 @@ def get_fixture_infos() -> list[FixtureInfo]:
|
||||
fixture_data = []
|
||||
for file, protocol in SUPPORTED_DEVICES:
|
||||
p = Path(file)
|
||||
folder = Path(__file__).parent / "fixtures"
|
||||
if protocol == "SMART":
|
||||
folder = folder / "smart"
|
||||
if protocol == "SMART.CHILD":
|
||||
folder = folder / "smart/child"
|
||||
p = folder / file
|
||||
|
||||
with open(p) as f:
|
||||
with open(file) as f:
|
||||
data = json.load(f)
|
||||
|
||||
fixture_name = p.name
|
||||
@@ -188,7 +190,7 @@ def filter_fixtures(
|
||||
IotDevice._get_device_type_from_sys_info(fixture_data.data)
|
||||
in device_type
|
||||
)
|
||||
elif fixture_data.protocol == "SMARTCAM":
|
||||
elif fixture_data.protocol in {"SMARTCAM", "SMARTCAM.CHILD"}:
|
||||
info = fixture_data.data["getDeviceInfo"]["device_info"]["basic_info"]
|
||||
return SmartCamDevice._get_device_type_from_sysinfo(info) in device_type
|
||||
return False
|
||||
|
Reference in New Issue
Block a user