elad-bar / ha-shinobi

Shinobi Video custom component for HA
53 stars 5 forks source link

Shinobi device keeps disappearing randomly. #28

Closed apoorv569 closed 2 years ago

apoorv569 commented 2 years ago

I recently added the Shinobi home assistant integration it works. But it keeps appearing and disappearing randomly and sometimes disappears for quite some time.

2022-07-16_20-25 2022-07-16_20-26

Also there is some lag in stream it doesn't play smoothly and sometimes plays fast like the playback speed is set to 2x or something.

elad-bar commented 2 years ago

Hi, can you pls attach logs (debug level) for the disappearance issue? Delay is due to streaming configuration in Shinobi and HA, Shinobi UI delay is much lower because it's an internal protocol which allows it to work faster, when using the stream itself it becomes with more delay (pls compare to VLC), on to of that, you need to add the delay caused by HA which proxies the stream as well, The component by itself doesn't manipulate nor proxies the stream, it just provide the URL to the HA camera component

apoorv569 commented 2 years ago

Hi, can you pls attach logs (debug level) for the disappearance issue? Delay is due to streaming configuration in Shinobi and HA, Shinobi UI delay is much lower because it's an internal protocol which allows it to work faster, when using the stream itself it becomes with more delay (pls compare to VLC), on to of that, you need to add the delay caused by HA which proxies the stream as well, The component by itself doesn't manipulate nor proxies the stream, it just provide the URL to the HA camera component

If I filter logs by "Shinobi" I don't see much, just that its "Unavailable" or "Idle" or something..

How can I get more verbose logs?

I did try the stream with mpv it works fine.

apoorv569 commented 2 years ago

@elad-bar While looking in the logs today I found this error message for ha-shinobi plugin,

Error from stream worker: Error demuxing stream: [Errno 1414092869] Immediate exit requested: 'http://CAMERA_LINK/s.m3u8'

also shows this error message,

ERROR (MainThread) [custom_components.shinobi.component.api.shinobi_api] Failed to get data from [AUTH_TOKEN]/monitor/[GROUP_ID], Error: Cannot connect to host CAMERA_IP ssl:False [Try again], Line: 191

I have redacted the camera link (IP address and all) to just CAMERA_LINK and/or CAMERA_IP. Does this helps in diagnosing the error for why camera shows in Home Assistant for few seconds then goes to unavailable state again?

elad-bar commented 2 years ago

@apoorv569 , can you please let me know if it still happens with version v1.3.2?

thanks

apoorv569 commented 2 years ago

@apoorv569 , can you please let me know if it still happens with version v1.3.2?

thanks

I tried the new version, it is definitely a lot stable now than before, but it does still occasionally becomes unavailable.

For the time being I was and still am using the Generic Camera integration and directly stream the rtsp stream from the camera as it seems to be stable.

BTW I also moved both Shinobi and HomeAssistant to their own VM instead of running them in docker.

elad-bar commented 2 years ago

not sure I understand, as I run Shinobi and HA on docker without any issues as you described, so most probably we need to understand the term disappearing you have used :)

did you mean that the status of the camera entity goes offline (disconnected / stopped) or the camera entity is not available anymore?

if the camera entity's status goes offline, it most probably realted (same goes for the lag) by the NVR software which in this case - Shinobi Video server.

if the entity is not available anymore, do you see errors in log related to the component? if not - please set the component's logging to debug, run it for a while, and once it happens post the log (as zipped file) without sensitive data.

thanks