Problem with stream component setup

I have a little problem starting up homeassistant!
During the first startup with the copied configuration it ran into errors:
https://pastebin.com/TKeS4vu2

Alright, I see 2 things when reading over it quickly. It is missing some dependencies and the ssl certificate used is either invalid, in the wrong location or unreadable.

Tbh, when starting up a fresh install best practice would be to add the components one by one, but I can understand this might be a lot of work. If you happen to know which components require separate dependencies you can look in the docs for that specific component on how to install those. For example: IKEA Tradfri requires autoconf, stream requires a bunch of dependencies and there are several other components that will require something.

To start off with I would suggest fixing the SSL certificate first (or remove it all together for the time being) so that you can at least access the frontend. That will save a lot of headache as you can see in the frontend which components did not load, or which components would require extra setup. For example, IKEA Tradfri requires you to enter a code in the frontend before you can use it. Some integrations can be installed from the UI, but there are too many to name them all here.

What I would do is start Home Assistant clean with the default configuration and work from there. This way you will at least know if HA starts at all or not and from there you can add things one by one. Most of the time, integrations are done via the UI (unless there is not one available yet). Most sensors do not require a setup as they are in core HA. For example if you use MQTT with discovery, you will have to do this in the UI. If you enter MQTT config manually then you can only use autodiscovery if you only setup the broker and not the entities.

I hope this helps a bit. I did a complete fresh install of HA a few weeks ago (I have over 18.000 lines of code in my config files combined). What I did was to let HA auto discover everything first and work from there. Cutting snippets of my old code into the new one (the ones that can’t be discovered automatically etc).

After you reconfigured everything, copy your ui-lovelace.yaml file back (or if you use storage mode do it from there). I would also recommend you to start HA with the states UI, as Lovelace can bug if there are entities that do not exist or if there are entities with a different name.

I will have to add though that this process might take a bit of time depending on the size of your setup. It took me a whole evening to do my setup, I chose for a fresh setup and only copying stuff I needed from my old setup as I did not want old unused stuff to be copied over as well.

Oh I forgot to mention, you will only have to do this for components, you will not need to rewrite your entire lovelace setup. Just make sure the entity names are corresponding after the initial configuration. Sometimes entities get a different name after a fresh install (but probably most will stay the same).

Yeah srry for the long text, not easy to explain. Anyways try this, not sure if it will work, but you could try:

sudo apt install ffmpeg

Edit: I guess you figured it out already as your post is withdrawn :smiley:

Haha yes I figured it out ^^

Thank you very much for your help <3
I really love this Community :smiley:

1 Like

You are most welcome!

Edit: if by any chance you are looking for ideas you can check my github repo:

1 Like

I already did ^^
I’m using your vertical-stack-in-card template ^^ Loving it :smile:

Have a nice evening from Germany(To avoid confusion ^^)

Haha, it’s evening here as well neighbor (Netherlands here). Well have a nice evening, if you ever run into trouble just ask and I will try to answer it, but like most people I do not have the answer to all questions haha.

@WolfsW3lp3 one last question, did you get the stream setup working? As this was the original question in this thread?

Yes stream setup worked perfectly :smiley:
But I ran into another problem with streaming my cameras (RTSP Streams not working anymore)
https://pastebin.com/fNg9ZYsU

Unauthorized is not true the login credentials are correct!

Hm unfortunately I am not so good with this stuff. I assume you installed the dependencies I posted earlier? (The long string from several posts ago). Might try restarting the camera’s (or software if you use something like zoneminder or blueiris) and restart HA just to be sure. Oh and make sure your HA instance has local network access, but I assume this is working as everything else is working for you.

Edit: to be really sure it isn’t something else you could test the camera stream in vlc or other software just to be sure that the stream is reachable. Alternatively, if you did not expose the camera to the internet directly, you could try to remove the user/pwd and try again. Personally I would let HA manage the camera and not expose the rtsp port to the internet.

Yes I executed the long string ^^

Wow I had the exact same idea with VLC ^^ (Restaring the camera right now because VLC cant get a connection with rtsp but the webinterface still works, strange ^^)
No the camera has no internet connecting only locally!
Nobody can use the rtsp port so you don’t have to worry about it because every port gets blocked by my router.

I will get in touch later if I found out something.

Well it was a common problem I had, the stream would be unreachable for some reason, or would be reachable but only the webinterface like you said. Or it would just give a black screen. For me most of the times a camera restart would fix it. Though there are so many different camera’s that I can’t possibly tell if yours would work the same way or not.

Though, I do know that not every camera is supported in the stream component. There is a list somewhere of all camera’s that are supported. Will try to find it later.

Ehm ok…
I tried to change the rtsp url of the camera and saved the configuration.
Now HA telling me that:

Unable to read file /home/ha/.homeassistant/configuration.yaml: ‘utf-8’ codec can’t decode byte 0xfc in position 2762: invalid start byte

Edit:
Removed all cameras for now and the error disappeared.
I dont know why :frowning:

Edit 2:
Ok I think I am a little bit stupid ^^ Saved it in the wrong translation

Could you post your configuration? Configuration.yaml and the camera config? Maybe I can find something there. Did VLC work at least?

Edit: also mention which camera you use plz.

Yeah VLC worked

This is my config:
https://pastebin.com/1WzV3Swp
The Camera I use is the Mobotix T25

Edit: Sorry for late answer. I tried to fix it by my own but nothing worked :frowning:
A few tries removed the error but the stream buffering and buffering.
Debug Message:

2019-05-29 22:18:46 INFO (MainThread) [homeassistant.components.stream] Started stream: rtsp://user:[email protected]:1348/stream0/mobotix.mjpeg

Ok, I have checked some stuff for you, and there are some lines that I have some doubts about.

First of all, I see that you have put ffmpeg: in your configuration.yaml file. I am not entirely sure if you would really need this (I don’t have it and it works perfectly fine).

Second, you have 2 camera’s right? The first one is a mjpeg one, this is not supported in stream, only generic camera is supported for streams. You can still stream when clicking on the image but it is not the same as the rtsp stream. (I have a usb cam which can’t do rtsp either, so no stream available other than what was already possible for a long time).

The second cam you have setup is a generic camera which might work. Though it isn’t listed in the supported camera’s list as far as I can see:
Stream Component: Confirmed Cameras and Configurations - You can check here when your camera gets added.

I myself have a xiaomi cam with dafang hacks and the configuration looks like this:

  - platform: generic
    stream_source: rtsp://192.168.0.75:8554/unicast
    still_image_url: https://192.168.0.75/cgi-bin/currentpic.cgi
    name: Gallerij Camera
    verify_ssl: false
    username: !secret xiaofang_usr
    password: !secret xiaofang_pwd

For the mobotix cam you will indeed have a longer string (so do not copy my setup) with the user/pwd in the address of the stream rtsp://user:[email protected]:1348/stream0/mobotix.mjpeg (obviously I copied this from your post and you should not use this again).
What I can see is that you have setup a max fps, I believe this is no longer supported and you would do right by removing that entire line. (it should say that in the logs as well but couldn’t find it, something in the lines of “extra keys not allowed”).
After fixing that line, you should check the stream url which usually shouldn’t end in a file extension (I don’t know about your specific camera, but most camera’s I have seen only use the extension for images, like you can see in my example)

I have found this site which I have used for all my camera’s in the past to find the right url for rtsp streams:
https://www.ispyconnect.com/man.aspx?n=mobotix&page=1 - I happen to have found the right page for your cam if I am correct. Try the example given on that page (add your username/pwd and ofc change the ip address). If all is good it might work. I say might as it is not on the confirmed list. Let me know what your results are.

Edit: Try other url’s from that page if it doesn’t work, sometimes it will accept other url’s depending on firmware, region etc.

I guess no longer an issue for you, but which version of Ubuntu are you running? Versions older that 18.04 LTS dont install a usable version of ffmpeg - https://docs.mikeboers.com/pyav/develop/installation.html

@walaj I actually have this version:

Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

@jimz011 I tried a few things but nothing really worked.
The page you told me only showing examples for http stream. I tried a few, but nothing worked, I received this error:

2019-05-30 10:19:05 INFO (MainThread) [homeassistant.components.stream] Started stream: http://us:[email protected]/control/faststream.jpg?stream=full
2019-05-30 10:19:07 ERROR (stream_worker) [libav.mpjpeg] Expected boundary ‘–’ not found, instead found a line of 127 bytes
2019-05-30 10:19:07 ERROR (stream_worker) [homeassistant.components.stream.worker] Error demuxing stream: No dts in packet

The HTTP and RTSP Stream is working in VLC but I read that when UDP Stream is not working VLC falls back for TCP Stream and maybe stream: component only supports UDP Streams is that possible ? I understand not quite much of these things so its only a thought.

Edit: I did a little workaround! I involved BlueIris running on the Windows Server. BI receives the different streams, so i can access the camera streams with BI’s built in Webserver. Now I have my camera in Home Assistant + support Camera preload and recording :smiley: (even for the MJPEG camera)
But I have a delay up to 20s, which is too much. :confused:

Edit 2: I discovered a little inconspicuous error, maybe it sticks together with the delay ?

2019-05-30 13:37:10 ERROR (stream_worker) [libav.AVBSFContext] Invalid NAL unit 0, skipping.