Use reauth helpers in litterrobot (#128659)

This commit is contained in:
epenet 2024-10-18 17:21:29 +02:00 committed by GitHub
parent 1d24bfb99d
commit 4d41f82794
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -43,16 +43,11 @@ class LitterRobotConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle user's reauth credentials."""
errors = {}
if user_input:
entry_id = self.context["entry_id"]
if entry := self.hass.config_entries.async_get_entry(entry_id):
user_input = user_input | {CONF_USERNAME: self.username}
if not (error := await self._async_validate_input(user_input)):
self.hass.config_entries.async_update_entry(
entry,
data=entry.data | user_input,
return self.async_update_reload_and_abort(
self._get_reauth_entry(), data_updates=user_input
)
await self.hass.config_entries.async_reload(entry.entry_id)
return self.async_abort(reason="reauth_successful")
errors["base"] = error
return self.async_show_form(