fwestenberg / reolink_dev

Home Assistant Reolink addon
MIT License
550 stars 101 forks source link

Error starting stream, see logs for details (Stream never started), unregistered webhooks + plus lot of other bugs #433

Open Martinnygaard opened 2 years ago

Martinnygaard commented 2 years ago

First of all, I do not understadn this note, since the only integration I can find, is the one from within HACS? It doens seems like I can find a "New integration"?

Please make sure this bug is NOT about the Reolink HACS integration, only for the new Reolink HA integration.

Describe the bug

Error starting stream: (Continues to come whenever HA and Reolink is online)

Logger: homeassistant.components.stream
Source: components/stream/__init__.py:305
Integration: Stream (documentation, issues)
First occurred: January 23, 2022, 4:42:20 PM (28 occurrences)
Last logged: 7:58:47 AM

Error from stream worker: Error opening stream rtmp://192.168.1.32:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=HomeAssistant&password=SECRET_PASSWORD

Unregistered webhook, which continues to come as long as HA and Reolink is online:

Logger: homeassistant.components.webhook
Source: components/webhook/__init__.py:92
Integration: Webhook (documentation, issues)
First occurred: January 23, 2022, 3:15:48 PM (51 occurrences)Logger: homeassistant.components.webhook
Source: components/webhook/__init__.py:92
Integration: Webhook (documentation, issues)
First occurred: January 23, 2022, 3:15:48 PM (51 occurrences)
Last logged: January 23, 2022, 3:21:10 PM

Received message for unregistered webhook a6f1e7936197ea2f585d028c76b4f428f20f99458d132f7a739997b73e5b9245 from 192.168.1.34
Received message for unregistered webhook 9da99c62923af6d284a67d0f520dd3992f00585eefbd643ea29edad71b0a339a from 192.168.1.34
Received message for unregistered webhook fa4d8122eab80128d62622c2c2e82def44ea538536cae0c374639c48c133ab5a from 192.168.1.32
Received message for unregistered webhook 3504280db06fd1450e5cb20a58054592c16ce22e082737a941799f65ac822710 from 192.168.1.35
Received message for unregistered webhook b726d41667d232e02db09e7e7f85615b150a4f7ef7f8bebe4af7f86657ff63cf from 192.168.1.30
Last logged: January 23, 2022, 3:21:10 PM

Timeout fetching reolink.motion_states data - recurring all time as long as HA and reolink is online:

Logger: custom_components.reolink_dev
Source: helpers/update_coordinator.py:193
Integration: Reolink IP camera (documentation, issues)
First occurred: January 23, 2022, 3:17:11 PM (623 occurrences)
Last logged: 8:02:41 AM

Timeout fetching reolink.Garden Rear.motion_states data
Timeout fetching reolink.Yard - Front.motion_states data
Timeout fetching reolink.Driveway - West.motion_states data
Timeout fetching reolink.Driveway - East.motion_states data
Timeout fetching reolink.Yard - Rear.motion_states data

Environment: Please provide useful information about your environment, like:

Additional context I can add a lot of logs from my full log text, but since I think this MAYBE is multiple individual errors, I would like to hear what you need from me. Or if I should split this up to multiple issues.

cpainchaud commented 2 years ago

Hi!

This is a lot of bugs :p yet I do run exactly same hardware and software versions and have it work perfectly. Can you please provide logs with extra verbosity? (https://github.com/fwestenberg/reolink_dev/blob/master/TSHOOT.md)

Remember to disable logging afterward or it will quickly fill up your log file :)

Martinnygaard commented 2 years ago

Hi!

This is a lot of bugs :p yet I do run exactly same hardware and software versions and have it work perfectly. Can you please provide logs with extra verbosity? (https://github.com/fwestenberg/reolink_dev/blob/master/TSHOOT.md)

Remember to disable logging afterward or it will quickly fill up your log file :)

Hi, and thanks for quick response! Strange thing that you have same hardware, same firmware and no problems..

My actions:

  1. I added the debug logger config
  2. deleted my logfile (to get rid of all old errors)
  3. restarted home assistant
  4. navigated to a site in lovelace, showing the feeds (To make sure the feeds started)
logger:
  default: warning
  logs:
    custom_components.reolink_dev: debug
    custom_components.reolink_dev.base.data: warning
    reolink: debug

Full log Link to full log file: (Please note I have a few not Reolink related errors/warning that I am also trying to deal with - but not somthing I think should affect Reolink)

During this log file, I can infact see the camara feed from all camaras, except RLC-1220A, which throws the "Error starting stream, see logs for details (Stream never started)" Error. I am NOT getting any motion events from that camara, neither regular or AI motion allerts. All the other camaras do report motion event - however HA still register "Unknown webhooks" from their IP, as well as im still getting "Timeout fetching reolink.Garden Rear.motion_states data" errors on all of them.

Sorry for the terribly long log file.... I hope you kan use the "Search and find"-function ;-)

https://gist.github.com/Martinnygaard/058444cbeb7609fc4d6e0a1e0c9a3388

Martinnygaard commented 2 years ago

New issue - Failed to set up camera Sometimes I get this error (But not after each restart) One camera (The RLC-823 at IP 192.168.1.35) failed to set up, and the integration is marked as failed image Logs specific for this: (Or check the full log at line 4388) https://gist.github.com/Martinnygaard/d9a19c4c65156827c6ac972abbf48969

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/reolink_dev/base.py:216
Integration: Reolink IP camera (documentation, issues)
First occurred: 1:16:20 PM (1 occurrences)
Last logged: 1:16:20 PM

Error setting up entry Security Camera Garden Rear for reolink_dev
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/reolink_dev/__init__.py", line 75, in async_setup_entry
    if not await base.connect_api():
  File "/config/custom_components/reolink_dev/base.py", line 216, in connect_api
    if not await self._api.get_settings():
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 485, in get_settings
    response = await self.send(body)
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1627, in send
    raise CredentialsInvalidError()
reolink.exceptions.CredentialsInvalidError
cpainchaud commented 2 years ago

New issue - Failed to set up camera Sometimes I get this error (But not after each restart) One camera (The RLC-823 at IP 192.168.1.35) failed to set up, and the integration is marked as failed

Hi, This is happening sometimes to me as well, a reboot of the camera usually fixes the issue. Reolink software has so many issues :/ I feel sometime that I should drop the 'session token' schema and repeat login+password at every call instead

cpainchaud commented 2 years ago

You should remove your log file from gist : some error message from HA seem to expose your passwords

cpainchaud commented 2 years ago

Unregistered webhook, which continues to come as long as HA and Reolink is online:

They should stop after half an hour : Reolink does not support Webhook de-registration and will continue to hammer your webhooks for 15-30 minutes and HA webhooks URLs are changing after each restart

Martinnygaard commented 2 years ago

You should remove your log file from gist : some error message from HA seem to expose your passwords

I did a quick search for my password - and changed it to something that can't be used ;) But thanks for reminder.

Martinnygaard commented 2 years ago

Unregistered webhook, which continues to come as long as HA and Reolink is online:

They should stop after half an hour : Reolink does not support Webhook de-registration and will continue to hammer your webhooks for 15-30 minutes and HA webhooks URLs are changing after each restart

So I should expect these errors at every restart of HA?

cpainchaud commented 2 years ago

Unregistered webhook, which continues to come as long as HA and Reolink is online:

They should stop after half an hour : Reolink does not support Webhook de-registration and will continue to hammer your webhooks for 15-30 minutes and HA webhooks URLs are changing after each restart

So I should expect these errors at every restart of HA?

yes

Martinnygaard commented 2 years ago

Any ideas about the RLC-1220 with "Error starting stream, see logs for details (Stream never started)" Error and no motion events?

cpainchaud commented 2 years ago

Any ideas about the RLC-1220 with "Error starting stream, see logs for details (Stream never started)" Error and no motion events?

you should try to open it a in RTSP/RTMP software but beware that Reolink has issues with RTMP/RSTP because they use a bad combination of unsupported HD definitions and codecs making it incompatible with many software (Google will tell you a lot more), including HA. You should try sub streams (ext ... sub) settings to lower pixel count and also try several combinations of RTMP/RTSP (you may have to restart HA after settings changed)

enkama commented 2 years ago

+1 on that motion event error. Getting Motion states could not be queried from API.

CRCinAU commented 2 years ago

On the general bug hunt, I seem to get a lot of these:

2022-02-10 13:40:33 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 219, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 748, in get
    return await self.handle(request, camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 766, in handle
    image = await _async_get_image(
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 169, in _async_get_image
    image_bytes = await camera.async_camera_image(
  File "/usr/src/homeassistant/homeassistant/components/proxy/camera.py", line 252, in async_camera_image
    image = await async_get_image(self.hass, self._proxied_camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 208, in async_get_image
    return await _async_get_image(camera, timeout, width, height)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 169, in _async_get_image
    image_bytes = await camera.async_camera_image(
  File "/config/custom_components/reolink_dev/camera.py", line 197, in async_camera_image
    return await self._base.api.get_snapshot()
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 625, in get_snapshot
    return await self.get_still_image()
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 617, in get_still_image
    response = await self.send(None, param, expected_content_type='image/jpeg')
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1669, in send
    raise ApiError(
reolink.exceptions.ApiError: API returned HTTP status ERROR code 502/Bad Gateway

Then later, it'll end up with:

2022-02-10 13:41:47 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 219, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 748, in get
    return await self.handle(request, camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 766, in handle
    image = await _async_get_image(
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 169, in _async_get_image
    image_bytes = await camera.async_camera_image(
  File "/usr/src/homeassistant/homeassistant/components/proxy/camera.py", line 252, in async_camera_image
    image = await async_get_image(self.hass, self._proxied_camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 208, in async_get_image
    return await _async_get_image(camera, timeout, width, height)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 169, in _async_get_image
    image_bytes = await camera.async_camera_image(
  File "/config/custom_components/reolink_dev/camera.py", line 197, in async_camera_image
    return await self._base.api.get_snapshot()
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 625, in get_snapshot
    return await self.get_still_image()
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 617, in get_still_image
    response = await self.send(None, param, expected_content_type='image/jpeg')
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1677, in send
    raise CredentialsInvalidError()
reolink.exceptions.CredentialsInvalidError

Is this related?