Update HACS

This commit is contained in:
root
2022-05-23 17:48:47 -07:00
parent 3bdb8638a8
commit 1d83dd0c31
163 changed files with 862 additions and 11844 deletions

View File

@@ -31,6 +31,7 @@ class HacsFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
self.log = get_hacs_logger()
self._progress_task = None
self._login_device = None
self._reauth = False
async def async_step_user(self, user_input):
"""Handle a flow initialized by the user."""
@@ -118,8 +119,30 @@ class HacsFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_device_done(self, _user_input):
"""Handle device steps"""
if self._reauth:
existing_entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
self.hass.config_entries.async_update_entry(
existing_entry, data={"token": self.activation.access_token}
)
await self.hass.config_entries.async_reload(existing_entry.entry_id)
return self.async_abort(reason="reauth_successful")
return self.async_create_entry(title="", data={"token": self.activation.access_token})
async def async_step_reauth(self, user_input=None):
"""Perform reauth upon an API authentication error."""
return await self.async_step_reauth_confirm()
async def async_step_reauth_confirm(self, user_input=None):
"""Dialog that informs the user that reauth is required."""
if user_input is None:
return self.async_show_form(
step_id="reauth_confirm",
data_schema=vol.Schema({}),
)
self._reauth = True
return await self.async_step_device(None)
@staticmethod
@callback
def async_get_options_flow(config_entry):