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

Much delay with integration, none when adding camera manually #75

Closed
HorizonKane opened this issue Jul 9, 2020 · 45 comments
Closed

Much delay with integration, none when adding camera manually #75

HorizonKane opened this issue Jul 9, 2020 · 45 comments

Comments

@HorizonKane
Copy link

Hi,

I love your integration, it saved me a lot of work.

However, when watching the camera stream in HA, I have a very huge delay of 10 seconds.

Before using your integration, I added the camera like this:

  - platform: mjpeg
    mjpeg_url: http://192.168.83.25:8787/mjpg/Q6-1
    name: Q6-1
    username: !secret bi_username
    password: !secret bi_password
    authentication: basic

and have near to zero delay.

I just tried it again: Removed the integration and added the camera as shown - no delay.

Is there any way to fix this?

@elad-bar
Copy link
Owner

elad-bar commented Jul 9, 2020

The component is workinh with h264 stream which BI has a delay of 3 seconds, when working with mjpeg delay is being reduced but you cannot stream it to TV or any other media player,
Will add configuration to vhoose which stream type to work with

@rodrigoscoelho
Copy link

rodrigoscoelho commented Jul 9, 2020 via email

@HorizonKane
Copy link
Author

3 seconds would be okay, but it is 10. So I think I will just not stream and use mjpeg after you added it. Thanks for the fast reaction!

One more thing: When I configure the integration in the UI, there are many checkboxes but no text next to them. Is that missing or do I have a problem with my theme or something? :D

@elad-bar
Copy link
Owner

elad-bar commented Jul 9, 2020

10 is if you are using also stream component (should be preload stream "heckbox if you are using it), removed that component and got it to 3 sec,
Can you pls send me screen shot of the settings ui with the missing labels?

Thanks

@HorizonKane
Copy link
Author

HorizonKane commented Jul 9, 2020

After reinstalling the integration, all the labels are there.

Delay remains 10sec with preload stream unchecked.

But I noticed the motion sensor gets no input in HA. The Blue Iris camera is triggering as I also set an MQTT alert for it and the sensot I set up in HA recieves it. But the integrations motion sensor is quiet. Do I need special configuration in BI for that?I guss I have to set up fitting MQTT alerts?

Sorry for messing up different issues here!

@elad-bar
Copy link
Owner

Please make sure configuration of BI is according to the manual (readme)
In addition, please turn off the stream component to get less delay

@HorizonKane
Copy link
Author

Okay I oversaw the BI manual link, thank you!

But how do I disable the straem component? You set its the "preload stream" chckbox, but that doesn't change the delay for me.

@elad-bar
Copy link
Owner

Stream component available in 2 cases:

  • explicitly setting stream: in configuration.yaml
  • default home assistant configuration (default_config)

https://www.home-assistant.io/integrations/stream/

@HorizonKane
Copy link
Author

HorizonKane commented Jul 10, 2020

Can't find that in my configuration.yaml and can't remember that I ever used it.

But I got a default_config entry with nothing behind. Should I remove that?

I think being able to switch to mjpeg in the integration would be the best way to overcome this :)

@HorizonKane
Copy link
Author

Hi,

sorry for pushing but just want to find out if it makes sense to wait or if I should add the cams manually :)

Are you planning to insert a switch to use mjpeg instad of h264?

@elad-bar
Copy link
Owner

Probably will get to it during the weekend

@HorizonKane
Copy link
Author

Cool, thank you for your effort.

@elad-bar
Copy link
Owner

Working on that now, will update after I will test it

@elad-bar
Copy link
Owner

@HorizonKane, added the ability to set the intergation's stream type,
please let me know if it works for you

thanks

@HorizonKane
Copy link
Author

Hi,

thats great, thank you! Will test it right away tomorrow in the morning :)

@HorizonKane
Copy link
Author

Hi,

as soon as I set it to mjpeg, the camera image is not shown anymore. I switched for and backbetween H264 and MJPEG two times: H264 is working, mjpeg not. I also removed my other mjpeg integration of the same camera from my configuration.yaml to see if they intefere, but still no change.

@elad-bar
Copy link
Owner

Can you extract the url from the camera (using developer -> states) and try accessing the stream url from browser?
If it didn't work,
Please send the url,
In addition, can you try accessing the webui of BI to extract the url from there?

Thanks

@HorizonKane
Copy link
Author

HorizonKane commented Jul 20, 2020

In the states I find this:

stream_source: >-
  http://192.168.xx.xx:yyyy/mjpg/Q6-1/video.mjpg?session=<id removed>
still_image_url: >-
  http://192.168.xx.xx:yyyy/image/Q6-1?q=100&s=100&session=<removed>

...

entity_picture: >-
  /api/camera_proxy/camera.blueiris_q6_1?token=<removed>

When I try to access that URL in the browser it asks for authentication but will not accept my user. When I first go to http://192.168.xx.xx:yyyy and authenticate there it is working afterwards in the browser but not in HA.

My working camera where I access the stream is configured like this:

  - platform: mjpeg
    mjpeg_url: http://192.168.xx.xx:yyyy/mjpg/Q6-1
    name: Q6-1
    username: !secret bi_username
    password: !secret bi_password
    authentication: basic

and in states I find this URL:

entity_picture: >-
  /api/camera_proxy/camera.q6_1?token=<removed token>

*updated

@HorizonKane
Copy link
Author

Postet wrong cam code, updated

@b0ddu
Copy link

b0ddu commented Jul 20, 2020 via email

@HorizonKane
Copy link
Author

HorizonKane commented Jul 20, 2020

I just see the loading circle forever on mjpeg though the integration.

@elad-bar
Copy link
Owner

Loading circle it means that you work with stream: component, the problem with that component is that it overloads the BI server that cannot retrieve the stream

Regarding the attributes, there ahould be full path to the bi server's stream can you check if it accessible from browser

@HorizonKane
Copy link
Author

I checked that, see 4 posts above.

The server can't be overloaded, it has plenty of resources and only one cam added. Also mjpeg stream from BI is running fine with the camera I manually configured. Can I check something else?

@elad-bar
Copy link
Owner

Can you please post the attributes of the camera created by BI integration?
I would like to compare it to the manual camera you'be set up above,
It should include 2 specific attributes- still image and stream source as full path to the BI server

Thanks

@HorizonKane
Copy link
Author

HorizonKane commented Jul 21, 2020

I am confused a little bit, I think the exact information you are asking for is in the upper post. On the top you find the still image URL, stream URL and entity picture from the states like you asked for.

In the second two code boxes you find the information from the working BI camera I configured manually including stream URL.

Ich you are asking for the YAML created by the plugin for the BI cameras, I don't have that as config file creation is not working.

@elad-bar
Copy link
Owner

Sorry, missed that part 😃 ...
So the issue is authentication, can you post a screenshot of webserver configuration, I would like to define mine the same to check it or suggest you to switch to same as mine iv you would like

@HorizonKane
Copy link
Author

HorizonKane commented Jul 21, 2020

Sure, here you go. But what I dont understand at all: It is instantly working when I switch to H264 - so can it really be an authentication problem?

image

Ignore the no signals, they are just powered off :) The cam in question is running of course.

@elad-bar
Copy link
Owner

I'm using secure session key, and only for non internal network (but that all connections is not that problem),
I will remove that checkbox on mine later and get back to you

Thanks

@HorizonKane
Copy link
Author

Okay I see.

I am willing to change those options if necessary. I could also exclude LAN from the need to authenticate. Will wait for your findings, thank you.

@HorizonKane
Copy link
Author

No change when I switch those options.

@HorizonKane
Copy link
Author

Did you notice that when I integrate the camera manually, I dont define a stram_url at all, I just give the parameter mjpeg_picture. I also don't see a stream_source in my states there but it is working.

@HorizonKane
Copy link
Author

Hi,

any news? Is there anything else I can check to help figure this out?

@HorizonKane
Copy link
Author

I have it working with mjpeg.

On Mon, Jul 20, 2020, 4:52 AM HorizonKane @.***> wrote: Hi, as soon as I set it to mjpeg, the camera image is not shown anymore. I switched for and backbetween H264 and MJPEG two times: H264 is working, mjpeg not. I also removed my other mjpeg integration of the same camera from my configuration.yaml to see if they intefere, but still no change. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#75 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNIEK6VAMUSQ7NZXZ3CJOTR4QATTANCNFSM4OVTZDNA .

Would you mind to share your BI (webserver) settings? I tried elads and played aroud a lot but still no positive result with mjpeg.

@elad-bar
Copy link
Owner

Will try to get to it later today

@HorizonKane
Copy link
Author

HorizonKane commented Jul 29, 2020

Thank you. Let me know if I can deliver any helpful information.

And just as a site note: Everything else is working (camera connection, motion detection, h264... it is only the stream not shown and only on mjpeg option).

@elad-bar
Copy link
Owner

image

@HorizonKane
Copy link
Author

Thats like I tried it, too. I can also access the stream url from the state without problems and my manually configured mjpeg cam is working. When I switch your integration back to H264 its working (with 10sec delay) but as soon as I go back to mjpeg I get only the circle again.

@elad-bar
Copy link
Owner

@HorizonKane so just to understand, 10 days ago you've mentioned the 2 links to get to the camera,
one of them is without the BI component - manual setup of camera using the following path:
http://192.168.xx.xx:yyyy/mjpg/Q6-1

while BI component is generating the following path:
http://192.168.xx.xx:yyyy/mjpg/Q6-1/video.mjpg?session=

the second path is not being loaded by the stream component of HA while the first one does

did I get it correct?
asking to understand if that's the scenario I need to run locally

@HorizonKane
Copy link
Author

HorizonKane commented Jul 30, 2020

I will just post you what I actually see now.

The camera from your integration, with mjpeg as format looks like this in states:

access_token: <some token>
friendly_name: BlueIris Q6-1
stream_source: >-
  http://192.168.xx.xx:yyyy/mjpg/Q6-1/video.mjpg?session=<some session>
still_image_url: >-
  http://192.168.xx.xx:yyyy/image/Q6-1?q=100&s=100&session=<some session>
name: Q6-1
id: Q6-1
FPS: 14.97
Audio support: true
Width: 1920
Height: 1080
Is Online: true
Is Recording: false
Issue: false
'Alerts #': 0
'Triggers #': 0
'Clips #': 0
'No Signal #': 810
Error: ''
entity_picture: >-
  /api/camera_proxy/camera.blueiris_q6_1?token=<some token>
supported_features: 2

When I copy the stream_source URL to my browser I get the live picture right away.

The (same) camera I configured myself looks like this in the states:

access_token: <some token>
friendly_name: Q6-1
entity_picture: >-
  /api/camera_proxy/camera.q6_1?token=<some token>
supported_features: 0

and like this in configuration.yaml:

camera:
  - platform: mjpeg
    mjpeg_url: http://192.168.xx.xx:yyyy/mjpg/Q6-1
    name: Q6-1
    username: !secret bi_username
    password: !secret bi_password
    authentication: basic

The second one is loading, the one from the integration not:

image
image

@elad-bar
Copy link
Owner

elad-bar commented Aug 7, 2020

Ok, found the issue, component is using the basic camera with implementation of Generic IP Camera,
since it works with Stream component you have the delay,
the camera you've set up is MJPEG camera which is not working with Stream component.

I need to add the support for MJPEG camera implementation in case configuration is for MJPEG, otherwise, it will work with Generic IP Camera.

Will update later this weekend about progress

thanks

@HorizonKane
Copy link
Author

Cool.

Thank you for your continued effort!! Really appreciate the work you and others do to make such stuff available to others.

@Rodrigodg6
Copy link

Rodrigodg6 commented Aug 8, 2020 via email

@elad-bar
Copy link
Owner

elad-bar commented Aug 8, 2020

released new version, please let me know if now it works out of the box for you

thanks

Implemented enhancements:

  • New integration's option to control whether the camera component is using the Stream component or not, requires restart, default is without Stream support #75

@HorizonKane
Copy link
Author

Seems to be working like a charm now :) Thank you!!!

@elad-bar
Copy link
Owner

Great! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants