Fix Yale optionsflow (#65072)

This commit is contained in:
G Johansson 2022-01-27 21:01:30 +01:00 committed by GitHub
parent 696b930b1c
commit e92078cf50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,7 +161,10 @@ class YaleOptionsFlowHandler(OptionsFlow):
errors = {}
if user_input:
if len(user_input[CONF_CODE]) not in [0, user_input[CONF_LOCK_CODE_DIGITS]]:
if len(user_input.get(CONF_CODE, "")) not in [
0,
user_input[CONF_LOCK_CODE_DIGITS],
]:
errors["base"] = "code_format_mismatch"
else:
return self.async_create_entry(title="", data=user_input)
@ -171,7 +174,10 @@ class YaleOptionsFlowHandler(OptionsFlow):
data_schema=vol.Schema(
{
vol.Optional(
CONF_CODE, default=self.entry.options.get(CONF_CODE)
CONF_CODE,
description={
"suggested_value": self.entry.options.get(CONF_CODE)
},
): str,
vol.Optional(
CONF_LOCK_CODE_DIGITS,