Skip to content

Commit

Permalink
Code review: use correct flow handler type in cast
Browse files Browse the repository at this point in the history
  • Loading branch information
davet2001 committed Dec 28, 2024
1 parent 9e3964f commit 24b1d88
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion homeassistant/components/generic/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,14 +578,15 @@ async def ws_start_preview(
_LOGGER.debug("Generating websocket handler for generic camera preview")

flow_id = msg["flow_id"]
flow: GenericIPCamConfigFlow | GenericOptionsFlowHandler
if msg.get("flow_type", "config_flow") == "config_flow":
flow = cast(
GenericIPCamConfigFlow,
hass.config_entries.flow._progress.get(flow_id), # noqa: SLF001
)
else: # (flow type == "options flow")
flow = cast(
GenericIPCamConfigFlow,
GenericOptionsFlowHandler,
hass.config_entries.options._progress.get(flow_id), # noqa: SLF001
)
user_input = flow.preview_cam
Expand Down

0 comments on commit 24b1d88

Please sign in to comment.