Fix ZHA device lookup when ZHA devices are shared with additional integrations (#124429)
* Fix ZHA device lookup when ZHA devices are shared with additional integrations * clean up except error types * remove impossible to create exceptions
This commit is contained in:
parent
3e3d27f48d
commit
e85755fbda
1 changed files with 6 additions and 10 deletions
|
@ -1012,16 +1012,12 @@ def async_get_zha_device_proxy(hass: HomeAssistant, device_id: str) -> ZHADevice
|
||||||
_LOGGER.error("Device id `%s` not found in registry", device_id)
|
_LOGGER.error("Device id `%s` not found in registry", device_id)
|
||||||
raise KeyError(f"Device id `{device_id}` not found in registry.")
|
raise KeyError(f"Device id `{device_id}` not found in registry.")
|
||||||
zha_gateway_proxy = get_zha_gateway_proxy(hass)
|
zha_gateway_proxy = get_zha_gateway_proxy(hass)
|
||||||
try:
|
ieee_address = next(
|
||||||
ieee_address = list(registry_device.identifiers)[0][1]
|
identifier
|
||||||
ieee = EUI64.convert(ieee_address)
|
for domain, identifier in registry_device.identifiers
|
||||||
except (IndexError, ValueError) as ex:
|
if domain == DOMAIN
|
||||||
_LOGGER.error(
|
)
|
||||||
"Unable to determine device IEEE for device with device id `%s`", device_id
|
ieee = EUI64.convert(ieee_address)
|
||||||
)
|
|
||||||
raise KeyError(
|
|
||||||
f"Unable to determine device IEEE for device with device id `{device_id}`."
|
|
||||||
) from ex
|
|
||||||
return zha_gateway_proxy.device_proxies[ieee]
|
return zha_gateway_proxy.device_proxies[ieee]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue