burnnat / ha-polar

Polar fitness tracking integration for Home Assistant.
MIT License
9 stars 8 forks source link

`base_url` property is deprecated #6

Open MateEke opened 4 years ago

MateEke commented 4 years ago

0.110 Rel notes

burnnat commented 4 years ago

Thanks, I had seen the note but haven't yet upgraded to 0.110 for testing. Will get this updated shortly 👍

davedan commented 4 years ago

I think it's related. When I try to configure this integration, once the configuration is added to the configuration.yaml, it's discovered in the integrations page. When I click for configuration I get the following error: Ups, something went wrong, try again later.

Checking the URL I see is actually using my local URL in the redirect_uri: https://flow.polar.com/oauth2/authorization?client_id=&response_type=code&state=&redirect_uri=http%3A%2F%2F%3A8123%2Fapi%2Fpolar_auth

instead of using the External URL.

I'm running Home Assistant 0.112.4 (installation_type | Home Assistant Supervised )

hope this helps.

tomecki88 commented 4 years ago

Hi @burnnat, hass also reporting this in logs:

Logger: homeassistant.components.http
Source: components/http/__init__.py:180
Integration: HTTP (documentation, issues)
First occurred: 9:46:07 (4 occurrences)
Last logged: 9:52:38

Detected use of deprecated `base_url` property, use `homeassistant.helpers.network.get_url` method instead. Please report issue to the custom component author for polar using this method at custom_components/polar/config_flow.py, line 26: callback_url = f"{hass.config.api.base_url}{AUTH_CALLBACK_PATH}"
joopy commented 3 years ago

Any update on this? Would love to test Polar integration in Home assistant.

Aohzan commented 3 years ago

you can replace the line callback_url = f"{hass.config.api.base_url}{AUTH_CALLBACK_PATH}" by callback_url = f"{hass.config.external_url}{AUTH_CALLBACK_PATH}"

the authentication will work, but all my sensors stays in Unknown state