Skip Huawei LTE device registry setup with no identifiers or connections (#50261)

Closes https://github.com/home-assistant/core/issues/50182
pull/50414/head
Ville Skyttä 2021-05-10 18:27:09 +03:00 committed by GitHub
parent fca56993c6
commit 3fab21ebc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 20 deletions

View File

@ -393,6 +393,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
router.subscriptions.clear()
# Set up device registry
if router.device_identifiers or router.device_connections:
device_data = {}
sw_version = None
if router.data.get(KEY_DEVICE_INFORMATION):
@ -401,7 +402,9 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
if device_info.get("DeviceName"):
device_data["model"] = device_info["DeviceName"]
if not sw_version and router.data.get(KEY_DEVICE_BASIC_INFORMATION):
sw_version = router.data[KEY_DEVICE_BASIC_INFORMATION].get("SoftwareVersion")
sw_version = router.data[KEY_DEVICE_BASIC_INFORMATION].get(
"SoftwareVersion"
)
if sw_version:
device_data["sw_version"] = sw_version
device_registry = await dr.async_get_registry(hass)