From df6975cae0053f66e7f5e27341310dc79f3ad733 Mon Sep 17 00:00:00 2001 From: basbruss <4a3.brussee.bas@gmail.com> Date: Sun, 26 May 2024 09:30:00 +0200 Subject: [PATCH] Fix test in Config Flow --- custom_components/adaptive_cover/config_flow.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/adaptive_cover/config_flow.py b/custom_components/adaptive_cover/config_flow.py index 5598514..6ea0b56 100644 --- a/custom_components/adaptive_cover/config_flow.py +++ b/custom_components/adaptive_cover/config_flow.py @@ -337,7 +337,7 @@ async def async_step_vertical(self, user_input: dict[str, Any] | None = None): """Show basic config for vertical blinds.""" self.type_blind = SensorType.BLIND if user_input is not None: - if user_input[CONF_MAX_ELEVATION] is not None and user_input[CONF_MIN_ELEVATION] is not None: + if user_input.get(CONF_MAX_ELEVATION) is not None and user_input.get(CONF_MIN_ELEVATION) is not None: if user_input[CONF_MAX_ELEVATION] <= user_input[CONF_MIN_ELEVATION]: return self.async_show_form( step_id="vertical", @@ -357,7 +357,7 @@ async def async_step_horizontal(self, user_input: dict[str, Any] | None = None): """Show basic config for horizontal blinds.""" self.type_blind = SensorType.AWNING if user_input is not None: - if user_input[CONF_MAX_ELEVATION] is not None and user_input[CONF_MIN_ELEVATION] is not None: + if user_input.get(CONF_MAX_ELEVATION) is not None and user_input.get(CONF_MIN_ELEVATION) is not None: if user_input[CONF_MAX_ELEVATION] <= user_input[CONF_MIN_ELEVATION]: return self.async_show_form( step_id="horizontal", @@ -377,7 +377,7 @@ async def async_step_tilt(self, user_input: dict[str, Any] | None = None): """Show basic config for tilted blinds.""" self.type_blind = SensorType.TILT if user_input is not None: - if user_input[CONF_MAX_ELEVATION] is not None and user_input[CONF_MIN_ELEVATION] is not None: + if user_input.get(CONF_MAX_ELEVATION) is not None and user_input.get(CONF_MIN_ELEVATION) is not None: if user_input[CONF_MAX_ELEVATION] <= user_input[CONF_MIN_ELEVATION]: return self.async_show_form( step_id="tilt", @@ -562,7 +562,7 @@ async def async_step_vertical(self, user_input: dict[str, Any] | None = None): CONF_MAX_ELEVATION, ] self.optional_entities(keys, user_input) - if user_input[CONF_MAX_ELEVATION] is not None and user_input[CONF_MIN_ELEVATION] is not None: + if user_input.get(CONF_MAX_ELEVATION) is not None and user_input.get(CONF_MIN_ELEVATION) is not None: if user_input[CONF_MAX_ELEVATION] <= user_input[CONF_MIN_ELEVATION]: return self.async_show_form( step_id="vertical", @@ -592,7 +592,7 @@ async def async_step_horizontal(self, user_input: dict[str, Any] | None = None): CONF_MAX_ELEVATION, ] self.optional_entities(keys, user_input) - if user_input[CONF_MAX_ELEVATION] is not None and user_input[CONF_MIN_ELEVATION] is not None: + if user_input.get(CONF_MAX_ELEVATION) is not None and user_input.get(CONF_MIN_ELEVATION) is not None: if user_input[CONF_MAX_ELEVATION] <= user_input[CONF_MIN_ELEVATION]: return self.async_show_form( step_id="horizontal", @@ -622,7 +622,7 @@ async def async_step_tilt(self, user_input: dict[str, Any] | None = None): CONF_MAX_ELEVATION, ] self.optional_entities(keys, user_input) - if user_input[CONF_MAX_ELEVATION] is not None and user_input[CONF_MIN_ELEVATION] is not None: + if user_input.get(CONF_MAX_ELEVATION) is not None and user_input.get(CONF_MIN_ELEVATION) is not None: if user_input[CONF_MAX_ELEVATION] <= user_input[CONF_MIN_ELEVATION]: return self.async_show_form( step_id="tilt",