Skip to content

Commit

Permalink
Config flow: avoid indexing errors checking local scan results.
Browse files Browse the repository at this point in the history
It looks like productKey is not always supported.

Comment on #1149
  • Loading branch information
make-all committed Dec 8, 2024
1 parent b0481d6 commit e7fd0c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom_components/tuya_local/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,11 @@ async def async_step_search(self, user_input=None):
except OSError:
local_device = {"ip": None, "version": ""}

if local_device["ip"] is not None:
if local_device.get("ip"):
_LOGGER.debug(f"Found: {local_device}")
self.__cloud_device["ip"] = local_device["ip"]
self.__cloud_device["version"] = local_device["version"]
self.__cloud_device["local_product_id"] = local_device["productKey"]
self.__cloud_device["ip"] = local_device.get("ip")
self.__cloud_device["version"] = local_device.get("version")
self.__cloud_device["local_product_id"] = local_device.get("productKey")
else:
_LOGGER.warning(f"Could not find device: {self.__cloud_device['id']}")
return await self.async_step_local()
Expand Down

0 comments on commit e7fd0c1

Please sign in to comment.