fwestenberg / reolink

Python Reolink package
MIT License
86 stars 25 forks source link

reolink traceback during boot #9

Closed mrand closed 3 years ago

mrand commented 3 years ago

Describe the bug

As I continue trying different things to get a reliable live-feed, I ran into a different traceback.

More generally, the integration only displays a live feed for a few minutes for me, before the image goes away and I start getting error messages in the log.

To Reproduce

Manually installed HA integration from the files in the HA pull request.

Changed from stream: to ffmpeg: and then restarted HA. Immediately (during bootup) got the following trace.

But it doesn't happen every time. I just rebooted and I got a stream fine, although my doorbell stream was offline. I let it run for 5 minutes this way, then I refreshed the browser. The doorbell stream came up, but after the browser refresh, the reolink component didn't display a stream and spit the following out to the log:

2020-12-06 15:11:07 ERROR (MainThread) [reolink.camera_api] Error translating Reolink settings response
2020-12-06 15:11:17 ERROR (MainThread) [reolink.camera_api] Error translating login response to json
2020-12-06 15:11:17 ERROR (MainThread) [reolink.camera_api] Error translating Reolink state response
2020-12-06 15:11:27 ERROR (MainThread) [reolink.camera_api] Error translating login response to json
2020-12-06 15:11:27 ERROR (MainThread) [homeassistant.components.camera] Error requesting stream: camera.driveway does not support play stream service

I'm using 5 GHz wifi to the 511W, so there might be small periods of times where it drops out, although I ran with vlc last night for quite a while and it seemed perfectly fine before adding the reolink integration.

configuration.yaml config for this:

reolink:
ffmpeg:

Expected behavior No tracebacks generated

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

Additional context

2020-12-06 13:41:48 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Driveway for reolink
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/reolink/__init__.py", line 72, in async_setup_entry
    await base.subscribe(webhook_url)
  File "/config/custom_components/reolink/base.py", line 76, in subscribe
    if not await self._sman.subscribe(self._webhook_url):
  File "/usr/local/lib/python3.8/site-packages/reolink/subscription_manager.py", line 126, in subscribe
    response = await self.send(headers, xml)
  File "/usr/local/lib/python3.8/site-packages/reolink/subscription_manager.py", line 83, in send
    async with session.post(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 1124, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 551, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 907, in start
    self._continue = None
  File "/usr/local/lib/python3.8/site-packages/aiohttp/helpers.py", line 656, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
fwestenberg commented 3 years ago

This errors definitely mean the login failed, and the stream depends on the same login token. I will try to look into this some more.

fwestenberg commented 3 years ago

V12 should fix this errors and decrease the number of log errors.