Don't prompt user to verify still image if none was provided in generic camera (#118599)

Skip user prompt for preview image if only stream
pull/118609/head
Dave T 2024-06-01 15:30:32 +01:00 committed by GitHub
parent ca89d22a34
commit b69789d056
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 10 deletions

View File

@ -361,6 +361,10 @@ class GenericIPCamConfigFlow(ConfigFlow, domain=DOMAIN):
self.user_input = user_input
self.title = name
if still_url is None:
return self.async_create_entry(
title=self.title, data={}, options=self.user_input
)
# temporary preview for user to check the image
self.context["preview_cam"] = user_input
return await self.async_step_user_confirm_still()

View File

@ -409,16 +409,9 @@ async def test_form_only_stream(
user_flow["flow_id"],
data,
)
assert result1["type"] is FlowResultType.FORM
assert result1["step_id"] == "user_confirm_still"
result3 = await hass.config_entries.flow.async_configure(
result1["flow_id"],
user_input={CONF_CONFIRMED_OK: True},
)
await hass.async_block_till_done()
assert result3["type"] is FlowResultType.CREATE_ENTRY
assert result3["title"] == "127_0_0_1"
assert result3["options"] == {
assert result1["type"] is FlowResultType.CREATE_ENTRY
assert result1["title"] == "127_0_0_1"
assert result1["options"] == {
CONF_AUTHENTICATION: HTTP_BASIC_AUTHENTICATION,
CONF_STREAM_SOURCE: "rtsp://user:pass@127.0.0.1/testurl/2",
CONF_USERNAME: "fred_flintstone",