al435
1
Hi
Im trying to add errors to OptionsFlow
class OptionsFlow(OptionsFlowWithConfigEntry):
async def async_step_init(self, user_input: dict[str, Any] | None = None) -> FlowResult:
errors = {"base": "test error"}
data_schema = vol.Schema({
vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
})
return self.async_show_form(step_id="init", data_schema=data_schema, errors=errors)
But I got empty error field
Could you help me please?
Did you add the key in the translation file?
al435
3
Yes, And it is the same nothing shown Only red line.
Actually, I have tried to use it in ConfigFlow without adding the key in the translation file like this
class MyConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_user(self, user_input: dict[str, Any] | None = None) -> FlowResult:
errors = {"base": "test error"}
data_schema = vol.Schema({
vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
})
return self.async_show_form(step_id="init", data_schema=data_schema, errors=errors)
And it works.
But for OptionsFlowWithConfigEntry it doesnt work. I dont know why