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

Added component camect, which streams camera video using WebRTC #22446

Closed
wants to merge 12 commits into from
Closed

Conversation

camect
Copy link

@camect camect commented Mar 26, 2019

Description:

Integrate with Camect, an affordable smart NVR, which cares about your privacy. See https://camect.com/ for more information.
This PR adds a new platform to the camera component so users could view cameras supported by Camect. In the future, we'll provide instructions to add a custom card so users will be able to view live video / footage / alerts using WebRTC.

Related issue (if applicable): fixes #

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>

Example entry for configuration.yaml (if applicable):

camect:
    host: camect.local
    port: 8443
    username: YOUR_USERNAME
    password: YOUR_PASSWORD

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

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

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

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@homeassistant
Copy link
Contributor

Hi @camect,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

homeassistant/components/camect/camera.py Outdated Show resolved Hide resolved
homeassistant/components/camect/camera.py Outdated Show resolved Hide resolved
homeassistant/components/camect/camera.py Outdated Show resolved Hide resolved
homeassistant/components/camect/camera.py Outdated Show resolved Hide resolved
homeassistant/components/camect/camera.py Show resolved Hide resolved
homeassistant/components/camect/camera.py Outdated Show resolved Hide resolved
homeassistant/components/camect/camera.py Outdated Show resolved Hide resolved
homeassistant/components/camect/camera.py Outdated Show resolved Hide resolved
homeassistant/components/camect/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/camect/__init__.py Outdated Show resolved Hide resolved
@camect camect changed the title Added component camect, which supports streaming camera video using W… Added component camect, which streams camera video using WebRTC Mar 26, 2019
@klaasnicolaas
Copy link
Member

@awarecan
Copy link
Contributor

Thanks for willing to integrate your product into Home Assistant.

However, your integration doesn't implement the most important HA camera's method camera_image(), so our user cannot see your camera through HA, but only through your own interface. If my understanding is right, why you want to integrate with HA at first place?

@camect
Copy link
Author

camect commented Mar 26, 2019

@awarecan Thanks for the quick response. We don't do the usual image camera way.
We use WebRTC to stream video from Camect Home device. The code in this pull request is mainly to help HA UI connect to Camect Home.
There is another change to project home-assistant-polymer to create a card for Camect camera. I am having a difficult time sync the code to HEAD now. Hope it'll resolve soon.

@awarecan
Copy link
Contributor

This is not how Home Assistant works. We don't create a front end card only for one device.

I am not sure if you have look at our new stream component debuted in release 0.90. WebRTC definitely is something we would like to bring in HA, but I would like to see a similar implement likes stream component for WebRTC component, e.g., we should be able to have a WebRTC support in our frontend, allow user to have real time communication with other family member etc. For the MVP(minimum viable product), I would like to see user can see any camera video source in a WebRTC client living in our frontend.

I would not accept a WebRTC feature which only support one specific vendor's device. Of course, that is only my personal opinion, you can still seek other members support.

We had some discussion about how far we want HA goes towards a surveillance system (maybe it is your product's position), most of us feel that HA is not and should not become a surveillance system. Base on this, I would recommend you rethink how you want to interact with HA, I suggest you can develop a hass.io add-ons, to loosely integrate with HA. I strongly suggest you checkout this MotionEye Addons

If you still feel that integrate into HA is important, then I would suggest you look at ZoneMinder as a reference.

@camect
Copy link
Author

camect commented Mar 27, 2019

@awarecan Thanks for all these suggestions. I think we still want an integration instead of an addon.
Camect Home does some complicated video analysis and AI. It's not likely to work well in most user's environment. I understand why you don't want a new card. Here is my proposal:

  • I am going to follow the ZoneMinder way: implement the camera_image method so users could see snapshots like other cameras using the default picture card
  • We provide a custom card (not checked in to HA) that users put into their local www folder. With this custom card, users would be able to see the video through WebRTC and a lot of other features from Camera Home, like smart alerts and footage, etc.
    What do you think of this?

@awarecan
Copy link
Contributor

It sounds good.

@balloob
Copy link
Member

balloob commented Mar 28, 2019

Custom cards living outside of HA is fine. Probably even the best approach as then people can mix and match with other Lovelace things. You can also consider using either panel_custom or panel_iframe to load resources from your box.

@balloob
Copy link
Member

balloob commented Mar 28, 2019

Also, consider adding a description to your PR 🤷‍♂️

Copy link
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of weird things in this PR. From routing font + JS files, forwarding all events to our event bus and not following platform requiremenets.

We will not further review any part of this PR until you add a description to your PR about who you are, what you are planning to do, and how integrating with us fits in.

@hunterjm
Copy link
Member

I agree with everyone here. Your camect-py package should utilize something like aiortc to establish a peer connection with your hardware and provide the requisite methods to fetch a still image so that we can follow the existing camera implementation. Since we already have the dependencies bundled in HASS builds from 0.90 with our stream component, you should be able to use a combination of aiortc and it's dependency pyAV to process your feed.

On another note, I am looking at expanding the stream component to be able to serve WebRTC feeds directly for real time integration with the frontend and streaming to Alexa devices. If you would like to collaborate on that, we could also expand the capabilities of stream to include consuming WebRTC feeds.

@camect
Copy link
Author

camect commented Mar 29, 2019

@balloob I fixed the problems you pointed out. Added a description to the PR. Sorry I missed it at the beginning. Let me know if more details are wanted. Thanks.

@camect
Copy link
Author

camect commented Mar 29, 2019

@hunterjm Thanks for the suggestions. To make sure I understand it correctly, do you plan to support WebRTC in stream component so it could feed RTSP/HLS video to Alexa using WebRTC? Or the other direction, consume WebRTC and convert that to HLS so frontend could stream it?
For the latter, why not just let frontend talk to the WebRTC provider directly?

@camect
Copy link
Author

camect commented Apr 29, 2019

After talked with our users, we think we'll go with a custom component instead. This way, we'll be able to provide more functionality like alerts to users. I'll close this thread for now. Thanks for all your help!

@camect camect closed this Apr 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants