Skip to content

Commit

Permalink
Merge pull request #177 from basbruss/fix-configflow
Browse files Browse the repository at this point in the history
Fix test in Config Flow
  • Loading branch information
basbruss authored May 26, 2024
2 parents 5b62166 + df6975c commit 1b90f2a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/adaptive_cover/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 1b90f2a

Please sign in to comment.