elad-bar / ha-blueiris

Integration with Blue Iris Video Security Software
182 stars 42 forks source link

Error getting new camera image: Cannot connect to host 192.168.x.xx:xxxx #39

Closed TheAlphaLaw closed 4 years ago

TheAlphaLaw commented 4 years ago

I receive thousands of these errors per day. When viewed directly on BlueIris playback is smooth without any lag, when viewed in HA the stream judders, skips and freezes and the following error is received:

Error getting new camera image: Cannot connect to host 192.168.2.xx:xxxx ssl:None [Connect call failed ('192.168.2.xx', xxxx)]

Amcrest 4K Camera Settings: FPS: 20 Resolution: 1080P Max Stream: 2048kb/s

Nothing I change corrects the HA stream for these cameras. They're all wired via POE to a Edgeswitch 24, no issues handling the load on any equipment.

elad-bar commented 4 years ago

the issues is related to the implementation of WebSocket connection of Stream, not related to the component, component just creates the camera entity, playback is by HA

If you will remove the stream: component it will work (that's what i've done)

TheAlphaLaw commented 4 years ago

Stream is not enabled in my config.

elad-bar commented 4 years ago

What is the CPU level? Can you post screenshots of the camera when it's in normal mode (lovelace) and opened in HA?

Thanks

elad-bar commented 4 years ago

@TheAlphaLaw , can you please post the screenshot?

thanks

TheAlphaLaw commented 4 years ago

@elad-bar Home Assistant is emulated on the same system as Blue Iris. HA has access to 6/12 threads of the CPU (8700k) which sits around 5 to 10% usage (total system load). I have 8 cameras pulled into HA.

When the cameras are brought into HA, there is judder and tick lag (random). When I view the Blue Iris web server from any other source, the playback is smooth.

I'm not 100% of what you're asking screenshot wise. Please see screenshots and let me know if that's what you need. You'll notice the "Preload steam" option is available but stream is not enabled in any config.

Lovelace Lovelace_Open HA_Open

TheAlphaLaw commented 4 years ago

@elad-bar Anything else needed for you here?

elad-bar commented 4 years ago

I'm not 100% of what you're asking screenshot wise.

According to the screenshots you are using Stream component (Preload stream checkbox), there is an issue with the implementation of HA WebSocket and as result of that you see that judder and tick lag. Issues #9 and #47 are exactly about it.

Can you repeat the steps from issue #47 taken by tiaanv?

one of the attributes of the camera component that being created is the still / stream URL, you can create a dedicated component (GenericCamera) using those URLs to check how it works without my component

According to tiaanv it was:

Without your component (as expected). I get the exact same result.

And

If I open the stream URL directly in VLC, it's the same.... That's interesting..... So this is clearly a BI issue directly...

TheAlphaLaw commented 4 years ago

@elad-bar How do I disable the stream component? It's not enabled in config and was not enabled manually.

elad-bar commented 4 years ago

in case you are using default configuration, you cannot do that, you need to switch to full configuration mode which you controls exactly what will run

deafult configuration looks like:

# Example configuration.yaml entry
default_config:

available at: https://www.home-assistant.io/integrations/default_config/

when it's being loaded it loads also the stream component:

"""Component providing default configuration for new users."""
try:
    import av
except ImportError:
    av = None

from homeassistant.setup import async_setup_component

DOMAIN = "default_config"

async def async_setup(hass, config):
    """Initialize default configuration."""
    if av is None:
        return True

    return await async_setup_component(hass, "stream", config)

original source code: https://github.com/home-assistant/core/blob/dev/homeassistant/components/default_config/__init__.py

elad-bar commented 4 years ago

@TheAlphaLaw any updates?

TheAlphaLaw commented 4 years ago

@elad-bar I haven't had a chance to test out this path and I may not. This could introduce issues in the future as the integrations currently loaded under default are not fully documented. I will likely use Blue Iris Web server directly and not integrate into HA at this time.