homebridge-kasa-python 2.5.2 → 2.5.3

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.
@@ -67,7 +67,16 @@ async def discover_devices(username=None, password=None, additional_broadcasts=N
67
67
 
68
68
  if manual_devices:
69
69
  for host in manual_devices:
70
- await discover_manual_device(host, username, password, devices)
70
+ try:
71
+ app.logger.debug(f"Discovering manual device: {host}")
72
+ discovered_device = await Discover.discover_single(host=host, username=username, password=password)
73
+ if discovered_device and hasattr(discovered_device, 'device_type'):
74
+ devices[host] = discovered_device
75
+ app.logger.debug(f"Discovered manual device: {host}")
76
+ else:
77
+ app.logger.warning(f"Manual device not found or missing device_type: {host}")
78
+ except Exception as e:
79
+ app.logger.error(f"Error discovering manual device {host}: {str(e)}")
71
80
 
72
81
  all_device_info = {}
73
82
  tasks = []
@@ -91,25 +100,6 @@ async def discover_devices(username=None, password=None, additional_broadcasts=N
91
100
  app.logger.debug(f"Device discovery completed with {len(all_device_info)} devices found")
92
101
  return all_device_info
93
102
 
94
- async def discover_manual_device(host, username, password, devices, retries=3, timeout=5):
95
- for attempt in range(retries):
96
- try:
97
- app.logger.debug(f"Discovering manual device: {host} (Attempt {attempt + 1}/{retries})")
98
- discovered_device = await Discover.discover_single(host=host, username=username, password=password, discovery_timeout=timeout)
99
- if discovered_device and hasattr(discovered_device, 'device_type'):
100
- devices[host] = discovered_device
101
- app.logger.debug(f"Discovered manual device: {host}")
102
- return
103
- else:
104
- app.logger.warning(f"Manual device not found or missing device_type: {host}")
105
- except Exception as e:
106
- app.logger.error(f"Error discovering manual device {host}: {str(e)}")
107
- if attempt < retries - 1:
108
- app.logger.debug(f"Retrying discovery for manual device: {host}")
109
- await asyncio.sleep(1)
110
- else:
111
- app.logger.error(f"Failed to discover manual device {host} after {retries} attempts")
112
-
113
103
  async def update_device_info(ip, dev: Device):
114
104
  app.logger.debug(f"Updating device info for {ip}")
115
105
  try:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Homebridge Kasa Python",
3
3
  "name": "homebridge-kasa-python",
4
- "version": "2.5.2",
4
+ "version": "2.5.3",
5
5
  "description": "Plugin that uses Python-Kasa API to communicate with Kasa Devices.",
6
6
  "license": "MIT",
7
7
  "type": "module",