Don't prompt user to verify still image if none was provided in generic camera (#118599)
Skip user prompt for preview image if only streampull/118609/head
parent
ca89d22a34
commit
b69789d056
|
@ -361,6 +361,10 @@ class GenericIPCamConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
self.user_input = user_input
|
self.user_input = user_input
|
||||||
self.title = name
|
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
|
# temporary preview for user to check the image
|
||||||
self.context["preview_cam"] = user_input
|
self.context["preview_cam"] = user_input
|
||||||
return await self.async_step_user_confirm_still()
|
return await self.async_step_user_confirm_still()
|
||||||
|
|
|
@ -409,16 +409,9 @@ async def test_form_only_stream(
|
||||||
user_flow["flow_id"],
|
user_flow["flow_id"],
|
||||||
data,
|
data,
|
||||||
)
|
)
|
||||||
assert result1["type"] is FlowResultType.FORM
|
assert result1["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result1["step_id"] == "user_confirm_still"
|
assert result1["title"] == "127_0_0_1"
|
||||||
result3 = await hass.config_entries.flow.async_configure(
|
assert result1["options"] == {
|
||||||
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"] == {
|
|
||||||
CONF_AUTHENTICATION: HTTP_BASIC_AUTHENTICATION,
|
CONF_AUTHENTICATION: HTTP_BASIC_AUTHENTICATION,
|
||||||
CONF_STREAM_SOURCE: "rtsp://user:pass@127.0.0.1/testurl/2",
|
CONF_STREAM_SOURCE: "rtsp://user:pass@127.0.0.1/testurl/2",
|
||||||
CONF_USERNAME: "fred_flintstone",
|
CONF_USERNAME: "fred_flintstone",
|
||||||
|
|
Loading…
Reference in New Issue