fwestenberg / reolink_dev

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

Reolink integration stop working after upgrade HA core 2022.3.1 #462

Open destrowu opened 2 years ago

destrowu commented 2 years ago

After installation of HA core 2022.3.1 all integration (model 520a) stopped working Log report this error: "The reolink_dev platform for the camera integration does not support platform setup. Please remove it from your config"

To Reproduce Just upgrade latest core version

Expected behavior workin as always :)

Screenshots

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

Additional context Camera continue to work fine in the Reolink App

cpainchaud commented 2 years ago

What version of this integration are you running? What was your previous version of HA?

destrowu commented 2 years ago

First time I had HA 2022.2.9 and integration v0.49, i had the problem afdter update HA core 2022.3.1 I've rollback with backup to 2022.2.9 Today I've seen the integration update v0.50 and I've try to install after upgrade HA core 2022.3.1 but the problem is still there

cpainchaud commented 2 years ago

I read HA release notes and found nothing obvious. Got to dig this one

davemenkehorst commented 2 years ago

Same error. same camera

`Logger: homeassistant.config_entries Source: helpers/network.py:172 First occurred: 01:03:45 (1 occurrences) Last logged: 01:03:45

Error setting up entry Voordeur for reolink_dev Traceback (most recent call last): File "/config/custom_components/reolink_dev/init.py", line 81, in async_setup_entry push = hass.data[DOMAIN][base.push_manager] KeyError: 'push_manager-ec71dbf0aae0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/reolink_dev/init.py", line 90, in async_setup_entry await push.subscribe(base.event_id) File "/config/custom_components/reolink_dev/base.py", line 354, in subscribe get_url(self._hass, prefer_external=False), File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 133, in get_url request_host = _get_request_host() File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 172, in _get_request_host raise NoURLAvailableError homeassistant.helpers.network.NoURLAvailableError`

I tried https and http

abenard1957 commented 2 years ago

New install error that look very similar to above. HA version: 2022-2-6 Camera: RLC-510A

Logger: homeassistant.config_entries Source: helpers/network.py:122 First occurred: 00:00:11 (1 occurrences) Last logged: 00:00:11

Error setting up entry Cam1-entree for reolink_dev Traceback (most recent call last): File "/config/custom_components/reolink_dev/init.py", line 81, in async_setup_entry push = hass.data[DOMAIN][base.push_manager] KeyError: 'push_manager-ec71db8a06bf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 327, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/reolink_dev/init.py", line 90, in async_setup_entry await push.subscribe(base.event_id) File "/config/custom_components/reolink_dev/base.py", line 354, in subscribe get_url(self._hass, prefer_external=False), File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 83, in get_url request_host = _get_request_host() File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 122, in _get_request_host raise NoURLAvailableError homeassistant.helpers.network.NoURLAvailableError

cpainchaud commented 2 years ago

https://www.home-assistant.io/blog/2022/03/02/release-20223/#updates-for-custom-integration-developers

If a user has the http integration configured to use SSL, it only accepts HTTPS traffic. This means that the internal URL needs to be set to use HTTPS too, and for the certificate to be valid, this needs to be a domain name.

A lot of integrations that we send the URL to will fail if the certificate is not valid (ie. Sonos, Cast).

To help the user get this right, the default for the get_url helper will now prefer the external address if SSL is configured.

This has a higher chance of being correct, delivering a better out-of-the-box experience to a larger group of users.

Since Reolink camera don't support HTTPS webhook as far as I know (they dont trust certificates most of the time you will either disable https on HA OR install a certificate that Reolink supports OR just leave it like that and let Webhook fail.

Best I can do on my side is to log an error in DEBUG mode by catching this exception so integration will load again

Schnabulation commented 2 years ago

If I might be of help: I'm connecting to Home Assistant over a reverse proxy. The frontend is served over HTTPS from the reverse proxy - however: internal connection from the proxy to Home Assistant is over plain HTTP. So for HASSIO the connection is always plain HTTP.

I tried to load the integration over the external URL with HTTPS and also the internal URL with HTTP. But both ways gave me the same error.

The http-config in my YAML looks like this:

# Reverse Proxy Config
http:
    use_x_forwarded_for: true
    trusted_proxies:
    - 192.168.10.1
    ip_ban_enabled: true
    login_attempts_threshold: 5
cpainchaud commented 2 years ago

please try 0.51 , now please note that if you keep mixing internal non-HTTP with external HTTPS address, it's not supported by HomeAssistant themselves

Schnabulation commented 2 years ago

Thank you for the fast reply - I really appreciate your work. (Sidenote: Can you maybe add a donation url to your repo? I'd like to donate a few bucks).

Sadly version 0.51 did not solve my issue. I still can't add the integration. It shows in the list but once I click it I get this error:

Error

I have also completely disabled HTTPS by removing the part in configuration.yaml and used the internal URL. But the issue persists.

cpainchaud commented 2 years ago

Hi,

You will have to provide all logs are described here: https://github.com/fwestenberg/reolink_dev/blob/master/TSHOOT.md

Schnabulation commented 2 years ago

Done that. Here is the part in the log regarding reolink_dev:

2022-03-14 11:25:13 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration reolink_dev: No module named 'custom_components.reolink_dev.const'

cpainchaud commented 2 years ago

I need all the logs, not what you think is right , actually I have 0 context out of this single log.

thank you

Schnabulation commented 2 years ago

I can understand that - however: my log includes sensitive information about my configuration so I will not do that. Maybe someone else can chime in.

Schnabulation commented 2 years ago

To add onto this: It seems like the issue is not with the component but with the HACS download. I found something in the logs that HACS was not able to download the repo from GitHub. Once I downloaded it manually and installed it using WinSCP it workes flawlessly.