Streaming RTSP Stream into home assistant

Hi, I am trying to stream video from my cctv in the Home Assistant so I can view it on the dashboard.

However I have searched high and low and tried all possible combinations to stream it. I can stream the camera in VLC using the link rtsp://admin:***@10.107.1.:00554/ch01/0 and it loads the stream fine.

Without adding the camera component and adding the following code

stream:
camera:
  - platform: generic
    still_image_url: http://10.107.1.***:00085/Streaming/Channels/101/picture
    stream_source: rtsp://admin:*******@10.107.1.***:00554/ch01/0
    username: "admin"
    password: "******"
    authentication: digest

I get the error

Once I install the custom camera component I get this error

All I am trying to do is play the stream. or even play it in a iframe or anyway possible. Or is this something not possible? Any help will be appreciated.

I had some similiar issue.
I managed to get it to work with the following lines in configuration.yaml - hope this helps:

camera:
  - platform: ffmpeg
    name: Xiaofang1
    input: -rtsp_transport tcp -i rtsp://192.168.1.213:8554/unicast

After that I created a Picture Glance Card Configuration Card

You should only need the following:

stream:
camera:
  - platform: generic
    still_image_url: http://10.107.1.x/Streaming/Channels/101/picture
    stream_source: rtsp://admin:[email protected]:554/ch01/0

You don’t normally need a port for the image.

Or

stream:
camera:
  - platform: generic
    still_image_url: http://admin:[email protected]/Streaming/Channels/101/picture
    stream_source: rtsp://admin:[email protected]:554/ch01/0
1 Like

Thanks for replying and helping.

I have tried all three above mentioned ways and every time it threw the same error while checking the configuration.yaml

Error “Component error: camera - cannot import name ‘get_url’ from ‘homeassistant.helpers.network’ (/usr/src/homeassistant/homeassistant/helpers/network.py)”

Might be worth sharing the camera make and model incase anyone can help with more relevant info?

Its a SWANN DVR4980. Which is actually a re-branded Hikvision system

This is how it works for me

camera:
  - platform: generic
    stream_source: rtsp://USER:PASS@ADDRESS:PORT/PATH_TO_STREAM
    still_image_url: http://ADDRESS/PATH_TO_IMAGE
    name: CAMERA_NAME
    verify_ssl: false
    authentication: basic
    username: USER
    password: PASS

1 Like

Thanks guys to all those that helped. Since updating to Home Assistant 0.110.2. Its working in all above methods. :slight_smile:

thank you , I used onvif device manager tool to detect the camera rtsp string and I used the card type mentioned here to add it to the main page .

For anyone else finding this topic in search of video integration in home assistant:
key for me also was to add the Picture Glance Card to the dashboard to see it live. At first I didn’t think my configuration worked because the default dashboard camera showed gray static content until I accidentally pressed it and saw the video feed pop up.

using the secrets.yaml file my config looks like this:
configuration.yaml:

camera: !include cameras.yaml

cameras.yaml:

- platform: generic
  stream_source: !secret rtsp_doorbell_url
  still_image_url: !secret rtsp_doorbell_still_image_url
  name: 'Doorbell camera'

the (redacted) secrets.yaml needs no reference and looks like this for a dahua doorbell:

# Use this file to store secrets like usernames and passwords.
# Learn more at https://www.home-assistant.io/docs/configuration/secrets/
rtsp_doorbell_url: rtsp://<user>:<url-adjusted-password>@<ip>:<port-like-554>/cam/realmonitor?channel=1&subtype=0
rtsp_doorbell_still_image_url: http://<user>:<url-adjusted-password>@<ip>/cgi-bin/snapshot.cgi?1
1 Like