fwestenberg / reolink_dev

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

Task exception was never retriever KeyError: 'use_https' #358

Open PatrykMadej opened 2 years ago

PatrykMadej commented 2 years ago

After losing power throughout the house, the integration stops working in the E1 Zoom. I had to add Reolink integration again.

Logger: homeassistant Source: custom_components/reolink_dev/init.py:125 Integration: Reolink IP camera (documentation, issues) First occurred: 11:54:19 (1 occurrences) Last logged: 11:54:19

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/reolink_dev/init.py", line 125, in update_listener base.enable_https(entry.options[CONF_USE_HTTPS]) KeyError: 'use_https'

I also found an additional log:

Ten błąd pochodzi z niestandardowej integracji.

Logger: homeassistant.config_entries Source: custom_components/reolink_dev/base.py:200 Integration: Reolink IP camera (documentation, issues) First occurred: 11:05:03 (1 occurrences) Last logged: 11:05:03

Error setting up entry Camera Room for reolink_dev Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection raise exceptions[0] File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect return await fut File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.1.61', 443)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/config/custom_components/reolink_dev/init.py", line 73, in async_setup_entry if not await base.connect_api(): File "/config/custom_components/reolink_dev/base.py", line 200, in connect_api if not await self._api.get_settings(): File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 416, in get_settings response = await self.send(body) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1116, in send if not await self.login(): File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 688, in login response = await self.send(body, param) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1147, in send async with self._aiohttp_session.post( File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 1117, in aenter self._resp = await self._coro File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 520, in _request conn = await self._connector.connect( File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 535, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 892, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection transp, proto = await self._wrap_create_connection( File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.61:443 ssl:default [Connect call failed ('192.168.1.61', 443)]

cpainchaud commented 2 years ago

Hi,

You did now follow the template which is asking version details. Please fill in the template

Did you have to add the camera again or was it found from previous saved data?

PatrykMadej commented 2 years ago

Sorry, Is that good? When I removed the integration and added it again I typed the IP, password and something else ...

Describe the bug I use integration Reolink IP camera but i install hacs... Is it not this integration? Every time I lost electricity like today. Integration was no-working.

To Reproduce Logger: homeassistant Source: custom_components/reolink_dev/init.py:125 Integration: Reolink IP camera (documentation, issues) First occurred: 11:54:19 (1 occurrences) Last logged: 11:54:19

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/reolink_dev/init.py", line 125, in update_listener base.enable_https(entry.options[CONF_USE_HTTPS]) KeyError: 'use_https'

I also found an additional log:

Ten błąd pochodzi z niestandardowej integracji.

Logger: homeassistant.config_entries Source: custom_components/reolink_dev/base.py:200 Integration: Reolink IP camera (documentation, issues) First occurred: 11:05:03 (1 occurrences) Last logged: 11:05:03

Error setting up entry Camera Room for reolink_dev Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection raise exceptions[0] File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect return await fut File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.1.61', 443)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/config/custom_components/reolink_dev/init.py", line 73, in async_setup_entry if not await base.connect_api(): File "/config/custom_components/reolink_dev/base.py", line 200, in connect_api if not await self._api.get_settings(): File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 416, in get_settings response = await self.send(body) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1116, in send if not await self.login(): File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 688, in login response = await self.send(body, param) File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1147, in send async with self._aiohttp_session.post( File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 1117, in aenter self._resp = await self._coro File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 520, in _request conn = await self._connector.connect( File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 535, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 892, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection transp, proto = await self._wrap_create_connection( File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.61:443 ssl:default [Connect call failed ('192.168.1.61', 443)]

Expected behavior After the power was restored, I expected the integration to work 😉

Screenshots If applicable, add screenshots to help explain your problem.

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

Additional context Add any other context about the problem here.

mattatcha commented 2 years ago

I think the issue here is that use_https is stored in the config data and not options like the code expects. https://github.com/fwestenberg/reolink_dev/blob/master/custom_components/reolink_dev/__init__.py#L125

            {
                "entry_id": "redacted",
                "version": 1,
                "domain": "reolink_dev",
                "title": "Front Door",
                "data": {
                    "host": "redacted",
                    "port": 443,
                    "use_https": true,
                    "username": "redacted",
                    "password": "redacted",
                    "channel": 1
                },
                "options": {
                    "protocol": "rtmp",
                    "stream": "main",
                    "stream_format": "h265",
                    "motion_off_delay": 30,
                    "playback_months": 2,
                    "playback_thumbnail_path": "/",
                    "timeout": 10
                },
                "pref_disable_new_entities": false,
                "pref_disable_polling": false,
                "source": "user",
                "unique_id": "redacted",
                "disabled_by": null
            },