Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow video stream preview in generic camera config flow #120970

Closed

Conversation

davet2001
Copy link
Contributor

@davet2001 davet2001 commented Jul 1, 2024

Proposed change

Add preview of video stream during config flow to allow user to verify stream settings when configuring.
stream_preview

The generic camera config flow was updated some time ago to show a preview of the still image before the config flow was complete, the aim was to help users get username/passwords correct without having to add a camera, then delete it if it didn't work. But so far that was only implemented on still images.

The real problem and most of the remaining questions that still occur on the forums are from users trying to set up cameras, and confusing rtsp settings, passwords, or simply not knowing how to find a valid stream URL for their camera.

This feature has been a goal of mine for some time but finally got round to it last weekend!

Attention points for reviewer (feedback wanted):

  • The aim is to set up a camera stream during one of the config flow steps without actually adding it to the hass object. This is done by creating the GenericCamera object, then immediately creating a stream URL for it. But I'm not sure if this is an ok thing to do...
    • We could possibly be left with a left over stream at the end (I can't see a big problem with this - it should disappear on restart),
    • I'm not fully sure of the consequences of creating a Camera but not adding it to the hass object properly.

Note that the above only concerns the stream preview. The final configured camera is unchanged by this PR.

I've tested it manually and added pytests.

A related frontend PR was needed to enable <ha-hls-player> to be shown during the config flow.

Once this is merged, I'll do a separate PR to add the same functionality to the options flow.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@davet2001
Copy link
Contributor Author

@hunterjm Would value your thoughts on this one!

@frenck
Copy link
Member

frenck commented Jul 4, 2024

There is a merge conflict, can you take a look?

../Frenck

@frenck frenck marked this pull request as draft July 4, 2024 18:52
@davet2001 davet2001 force-pushed the generic_camera_stream_preview_2 branch from 5f9796d to 3a3d893 Compare July 5, 2024 14:16
@davet2001 davet2001 marked this pull request as ready for review July 5, 2024 14:45
@davet2001
Copy link
Contributor Author

Replaced with #122563

@davet2001 davet2001 closed this Jul 24, 2024
@davet2001 davet2001 deleted the generic_camera_stream_preview_2 branch July 24, 2024 21:28
@github-actions github-actions bot locked and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants