Move lutron_caseta migration to happen after successful setup (#75204)

This commit is contained in:
J. Nick Koston
2022-07-14 20:48:30 +02:00
committed by GitHub
parent fde3489e86
commit 5f08052f40

View File

@@ -143,8 +143,6 @@ async def async_setup_entry(
ca_certs = hass.config.path(config_entry.data[CONF_CA_CERTS])
bridge = None
await _async_migrate_unique_ids(hass, config_entry)
try:
bridge = Smartbridge.create_tls(
hostname=host, keyfile=keyfile, certfile=certfile, ca_certs=ca_certs
@@ -167,6 +165,7 @@ async def async_setup_entry(
raise ConfigEntryNotReady(f"Cannot connect to {host}")
_LOGGER.debug("Connected to Lutron Caseta bridge via LEAP at %s", host)
await _async_migrate_unique_ids(hass, config_entry)
devices = bridge.get_devices()
bridge_device = devices[BRIDGE_DEVICE_ID]