mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-11 09:58:01 +00:00
cli: print model, https, and lv for discover list (#1339)
``` kasa --target 192.168.xx.xx discover list HOST MODEL DEVICE FAMILY ENCRYPT HTTPS LV ALIAS 192.168.xxx.xxx KP115(EU) IOT.SMARTPLUGSWITCH XOR 0 - Fridge 192.168.xxx.xxx L900-5 SMART.TAPOBULB KLAP 0 2 L900 192.168.xxx.xxx P115 SMART.TAPOPLUG AES 0 2 Nightdesk 192.168.xxx.xxx TC65 SMART.IPCAMERA AES 1 2 Tapo_TC65_B593 ``` Also handles `TimeoutError` and `Exception` during `update()` --------- Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
This commit is contained in:
@@ -160,6 +160,17 @@ def create_discovery_mock(ip: str, fixture_data: dict):
|
||||
login_version: int | None = None
|
||||
port_override: int | None = None
|
||||
|
||||
@property
|
||||
def model(self) -> str:
|
||||
dd = self.discovery_data
|
||||
model_region = (
|
||||
dd["result"]["device_model"]
|
||||
if self.discovery_port == 20002
|
||||
else dd["system"]["get_sysinfo"]["model"]
|
||||
)
|
||||
model, _, _ = model_region.partition("(")
|
||||
return model
|
||||
|
||||
@property
|
||||
def _datagram(self) -> bytes:
|
||||
if self.default_port == 9999:
|
||||
@@ -178,7 +189,10 @@ def create_discovery_mock(ip: str, fixture_data: dict):
|
||||
"encrypt_type", discovery_result.get("encrypt_info", {}).get("sym_schm")
|
||||
)
|
||||
|
||||
login_version = discovery_result["mgt_encrypt_schm"].get("lv")
|
||||
if not (login_version := discovery_result["mgt_encrypt_schm"].get("lv")) and (
|
||||
et := discovery_result.get("encrypt_type")
|
||||
):
|
||||
login_version = max([int(i) for i in et])
|
||||
https = discovery_result["mgt_encrypt_schm"]["is_support_https"]
|
||||
dm = _DiscoveryMock(
|
||||
ip,
|
||||
|
Reference in New Issue
Block a user