From 4959fce1e04df3ef84fa705df03d8d17e956eb07 Mon Sep 17 00:00:00 2001 From: Olen Date: Wed, 28 Jun 2023 19:18:45 +0200 Subject: [PATCH] Fix setting number of digits for verisure lock PIN (#95449) * Fix error when setting number of digits * Update test_config_flow.py Add test for empty code --- homeassistant/components/verisure/config_flow.py | 2 +- tests/components/verisure/test_config_flow.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/verisure/config_flow.py b/homeassistant/components/verisure/config_flow.py index 9392cdd9bc1..1fcf0eb9de2 100644 --- a/homeassistant/components/verisure/config_flow.py +++ b/homeassistant/components/verisure/config_flow.py @@ -329,7 +329,7 @@ class VerisureOptionsFlowHandler(OptionsFlow): ): int, vol.Optional( CONF_LOCK_DEFAULT_CODE, - default=self.entry.options.get(CONF_LOCK_DEFAULT_CODE), + default=self.entry.options.get(CONF_LOCK_DEFAULT_CODE, ""), ): str, } ), diff --git a/tests/components/verisure/test_config_flow.py b/tests/components/verisure/test_config_flow.py index b1e67766df8..af102cced98 100644 --- a/tests/components/verisure/test_config_flow.py +++ b/tests/components/verisure/test_config_flow.py @@ -583,6 +583,15 @@ async def test_reauth_flow_errors( CONF_LOCK_CODE_DIGITS: DEFAULT_LOCK_CODE_DIGITS, }, ), + ( + { + CONF_LOCK_CODE_DIGITS: 5, + }, + { + CONF_LOCK_CODE_DIGITS: 5, + CONF_LOCK_DEFAULT_CODE: "", + }, + ), ], ) async def test_options_flow(