Untitled
unknown
python
a year ago
957 B
12
Indexable
async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
if entry is None:
return self.async_abort(reason="Nothing to reconfigure")
errors: dict[str, str] = {}
if user_input is None:
user_input = {CONF_EMAIL: entry.data[CONF_EMAIL]}
else:
token = await self.async_get_token(user_input)
return self.async_update_reload_and_abort(
entry,
unique_id=self.token_subject(token),
title=user_input[CONF_EMAIL],
data={
CONF_EMAIL: user_input[CONF_EMAIL],
CONF_TOKEN: token,
},
)
return self.async_show_form(
step_id="reconfigure",
data_schema=self.add_suggested_values_to_schema(
STEP_USER_DATA_SCHEMA, user_input
),
errors=errors,
)Editor is loading...
Leave a Comment