Add debugging to assist in debugging already configured error (#108134)

This commit is contained in:
Allen Porter 2024-01-16 08:05:35 -08:00 committed by Franck Nijhof
parent 5521ab0b35
commit d2feee86b7
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3

View file

@ -210,6 +210,12 @@ class OAuth2FlowHandler(
_LOGGER.error("Error reading primary calendar: %s", err)
return self.async_abort(reason="cannot_connect")
await self.async_set_unique_id(primary_calendar.id)
if found := self.hass.config_entries.async_entry_for_domain_unique_id(
self.handler, primary_calendar.id
):
_LOGGER.debug("Found existing '%s' entry: %s", primary_calendar.id, found)
self._abort_if_unique_id_configured()
return self.async_create_entry(
title=primary_calendar.id,