home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.72k stars 30.84k forks source link

Reolink Integration only work, if Camera have Internet Access #112648

Closed weltzien closed 8 months ago

weltzien commented 8 months ago

The problem

My cameras are seperated to a other vlan, which have no interent access. with this configuration it is no possible to load the reolink integration for a camera in this vlan, if i enable internet access for the camera it works.

In the logs you can see the timeout and that it check for firmware update. Is it possible to disable this checking or cotinue after timeout?

best regards

chris

What version of Home Assistant Core has the issue?

core-2024.3.0

What was the last working version of Home Assistant Core?

core-2024.3.0

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Reolink

Link to integration documentation on our website

https://www.home-assistant.io/integrations/reolink/#troubleshooting

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Quelle: config_entries.py:504
Erstmals aufgetreten: 20:52:46 (8 Vorkommnisse)
Zuletzt protokolliert: 21:16:38

Error setting up entry Garten for reolink
Error setting up entry Einfahrt for reolink
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4164, in send_chunk
    response = await self._aiohttp_session.post(url=self._url, json=body, params=param, allow_redirects=False)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 961, in start
    with self._timer:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/reolink/__init__.py", line 135, in async_setup_entry
    results = await asyncio.gather(
              ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in async_config_entry_first_refresh
    await self._async_refresh(
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 318, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 274, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/reolink/__init__.py", line 104, in async_check_firmware_update
    return await host.api.check_new_firmware()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 1954, in check_new_firmware
    json_data = await self.send(body, expected_response_type="json")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4065, in send
    return await self.send_chunk(body, param, expected_response_type, retry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4314, in send_chunk
    return await self.send(body, param, expected_response_type, retry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4065, in send
    return await self.send_chunk(body, param, expected_response_type, retry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 4164, in send_chunk
    response = await self._aiohttp_session.post(url=self._url, json=body, params=param, allow_redirects=False)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 966, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/streams.py", line 622, in read
    await self._waiter
asyncio.exceptions.CancelledError

Additional information

No response

home-assistant[bot] commented 8 months ago

Hey there @starkillerog, mind taking a look at this issue as it has been labeled with an integration (reolink) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `reolink` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign reolink` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


reolink documentation reolink source (message by IssueLinks)

starkillerOG commented 8 months ago

@weltzien are you 100% sure you were running HA 2024.3.0 when you encountered this error? I specifically attempted to make a fix for this very issue that is first included in HA 2024.3.0. Apperently that may not have been enough.

starkillerOG commented 8 months ago

@weltzien Could you setup the integration while you do not have the internet blocked such that the integration is setup correctly. Then enable debug logging: https://www.home-assistant.io/docs/configuration/troubleshooting/#enabling-debug-logging Then block internet acces. Then restart the reolink integration and wait for it to fail and give the error as reported in this issue. Then disable debug logging and post the resulting log.txt file here.

weltzien commented 8 months ago

Hi,

i can only download the debug info on the camera which is working. at the other ones it is not possible. the cams which are not working a RLC-822A. Firmware: v3.1.0.1643_2402219215

image

config_entry-reolink-29a79d2eae520b9e0445390a494cb1f1.json

Logger: homeassistant.config_entries
Quelle: config_entries.py:504
Erstmals aufgetreten: 18:34:51 (1 Vorkommnisse)

Zuletzt protokolliert: 18:34:51

Error setting up entry Garten for reolink
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/reolink/__init__.py", line 60, in async_setup_entry
    await host.async_init()
  File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 173, in async_init
    await self.subscribe()
  File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 401, in subscribe
    self.register_webhook()
  File "/usr/src/homeassistant/homeassistant/components/reolink/host.py", line 502, in register_webhook
    webhook.async_register(
  File "/usr/src/homeassistant/homeassistant/components/webhook/__init__.py", line 53, in async_register
    raise ValueError("Handler is already defined!")
ValueError: Handler is already defined!
MartinHjelmare commented 8 months ago

The stack trace doesn't look as expected when asyncio.gather is used with return_exceptions=True. Any exceptions should raise when the return results are checked. Not sure what's going on.

It's as if an older version of the code was used.

weltzien commented 8 months ago

Hi, i was double checked and found a old "Dev Reolink" HAC Integration, after i removed it, the integration is working now. Thanks for your help.

best regards

Chris