Ensure unique id is set for esphome when setup via user flow (#77677)

This commit is contained in:
J. Nick Koston 2022-09-01 18:10:20 +00:00 committed by GitHub
parent e326dd2847
commit 9a5bdaf87e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 0 deletions

View file

@ -333,6 +333,10 @@ async def async_setup_entry( # noqa: C901
if entry_data.device_info is not None and entry_data.device_info.name:
cli.expected_name = entry_data.device_info.name
reconnect_logic.name = entry_data.device_info.name
if entry.unique_id is None:
hass.config_entries.async_update_entry(
entry, unique_id=entry_data.device_info.name
)
await reconnect_logic.start()
entry_data.cleanup_callbacks.append(reconnect_logic.stop_callback)