homebridge-kasa-python 2.5.4 → 2.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/python/kasaApi.py +17 -6
- package/package.json +1 -1
package/dist/python/kasaApi.py
CHANGED
|
@@ -59,8 +59,12 @@ async def discover_devices(username=None, password=None, additional_broadcasts=N
|
|
|
59
59
|
try:
|
|
60
60
|
app.logger.debug(f"Discovering devices on broadcast: {broadcast}")
|
|
61
61
|
discovered_devices = await Discover.discover(target=broadcast, username=username, password=password)
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
for ip, dev in discovered_devices.items():
|
|
63
|
+
if hasattr(dev, 'device_type'):
|
|
64
|
+
devices[ip] = dev
|
|
65
|
+
app.logger.debug(f"Added device {ip} from broadcast {broadcast} to devices list")
|
|
66
|
+
else:
|
|
67
|
+
app.logger.debug(f"Device {ip} from broadcast {broadcast} does not have a device_type and was not added")
|
|
64
68
|
app.logger.debug(f"Discovered {len(discovered_devices)} devices on broadcast {broadcast}")
|
|
65
69
|
except Exception as e:
|
|
66
70
|
app.logger.error(f"Error discovering devices on broadcast {broadcast}: {str(e)}")
|
|
@@ -70,11 +74,14 @@ async def discover_devices(username=None, password=None, additional_broadcasts=N
|
|
|
70
74
|
try:
|
|
71
75
|
app.logger.debug(f"Discovering manual device: {host}")
|
|
72
76
|
discovered_device = await Discover.discover_single(host=host, username=username, password=password)
|
|
73
|
-
if discovered_device
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
if discovered_device:
|
|
78
|
+
if hasattr(discovered_device, 'device_type'):
|
|
79
|
+
devices[host] = discovered_device
|
|
80
|
+
app.logger.debug(f"Discovered manual device: {host}")
|
|
81
|
+
else:
|
|
82
|
+
app.logger.warning(f"Manual device {host} is missing device_type and was not added")
|
|
76
83
|
else:
|
|
77
|
-
app.logger.warning(f"Manual device not found
|
|
84
|
+
app.logger.warning(f"Manual device {host} not found and was not added")
|
|
78
85
|
except Exception as e:
|
|
79
86
|
app.logger.error(f"Error discovering manual device {host}: {str(e)}")
|
|
80
87
|
|
|
@@ -86,7 +93,11 @@ async def discover_devices(username=None, password=None, additional_broadcasts=N
|
|
|
86
93
|
dev_type = dev.sys_info.get("mic_type") or dev.sys_info.get("type")
|
|
87
94
|
if hasattr(dev, 'device_type') and (dev_type and dev_type not in UNSUPPORTED_TYPES):
|
|
88
95
|
tasks.append(update_device_info(ip, dev))
|
|
96
|
+
app.logger.debug(f"Device {ip} with type {dev_type} added to update tasks")
|
|
97
|
+
else:
|
|
98
|
+
app.logger.debug(f"Device {ip} with type {dev_type} is unsupported and was not added to update tasks")
|
|
89
99
|
except KeyError:
|
|
100
|
+
app.logger.debug(f"Device {ip} has missing keys in sys_info and was not added to update tasks")
|
|
90
101
|
continue
|
|
91
102
|
|
|
92
103
|
try:
|
package/package.json
CHANGED