core: Setting up the Fitbit integration seems broken

The problem

Setting up the Fitbit integration seems to be broken for a few versions now. Last time I’ve seen it working was Oct 2021. When adding Fitbit to the sensors in the configuration.yaml does create the fitbit.conf for you. Filling in your id and secret does not seem to change anything.

In the past (as well in the documentation) there were persistent notifications telling you what to do. These are not here. So the information of what I’m supposed to do, what url to use, those don’t appear

What version of Home Assistant Core has the issue?

core-2022.5.5

What was the last working version of Home Assistant Core?

core-2021.10.?

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Fitbit

Link to integration documentation on our website

https://www.home-assistant.io/integrations/fitbit/

Diagnostics information

Log Details (ERROR) Logger: homeassistant.components.sensor Source: helpers/network.py:207 Integration: Sensor (documentation, issues) First occurred: 9:06:39 PM (1 occurrences) Last logged: 9:06:39 PM

Error while setting up fitbit platform for sensor Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 249, in _async_setup_platform await asyncio.shield(task) File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 58, in run result = self.fn(*self.args, **self.kwargs) File “/usr/src/homeassistant/homeassistant/components/fitbit/sensor.py”, line 243, in setup_platform redirect_uri = f"{get_url(hass, require_ssl=True)}{FITBIT_AUTH_CALLBACK_PATH}" File “/usr/src/homeassistant/homeassistant/helpers/network.py”, line 168, in get_url request_host = _get_request_host() File “/usr/src/homeassistant/homeassistant/helpers/network.py”, line 207, in _get_request_host raise NoURLAvailableError homeassistant.helpers.network.NoURLAvailableError

Example YAML snippet

sensor:
  - platform: fitbit
    clock_format: 12H
    monitored_resources:
      - "activities/steps"
      - "activities/distance"
      - "activities/heart"
      - "sleep/timeInBed"
      - "sleep/minutesAsleep"
      - "sleep/efficiency"

Anything in the logs that might be useful for us?

No response

Additional information

My guess is that notifications have changed somewhere between Q3 2021 and today. But I could be wrong.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 21 (3 by maintainers)

Most upvoted comments

I managed to get mine working following this guide: https://github.com/TheTroubleshooter/Home-Assistant/tree/main/Fitbit - Add Multiple Accounts I used the Fitbit1 files but removed the 1 if created a folder in config/custom_components/fitbit make sure you have https external url added otherwise fitbit api doesnt work. Follow a duck dns tutorial on youtube.

Anyone else seeing FitBit broken with these errors? Tried removing fitbit.conf file but HA frontend did not find sensors so did not go into auto-create conf file mode. YAML file still has previously correct/working entries. Appreciate and suggestions.

Log Details (ERROR) Logger: homeassistant.components.sensor Source: components/fitbit/sensor.py:196 Integration: Sensor (documentation, issues) First occurred: 5:21:28 AM (1 occurrences) Last logged: 5:21:28 AM

Error while setting up fitbit platform for sensor Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 281, in _async_setup_platform await asyncio.shield(task) File “/usr/local/lib/python3.10/concurrent/futures/thread.py”, line 58, in run result = self.fn(*self.args, **self.kwargs) File “/usr/src/homeassistant/homeassistant/components/fitbit/sensor.py”, line 196, in setup_platform authd_client.client.refresh_token() File “/usr/local/lib/python3.10/site-packages/fitbit/api.py”, line 156, in refresh_token token = self.session.refresh_token( File “/usr/local/lib/python3.10/site-packages/requests_oauthlib/oauth2_session.py”, line 452, in refresh_token self.token = self._client.parse_request_body_response(r.text, scope=self.scope) File “/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/clients/base.py”, line 448, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File “/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py”, line 441, in parse_token_response validate_token_parameters(params) File “/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py”, line 448, in validate_token_parameters raise_from_error(params.get(‘error’), params) File “/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/errors.py”, line 399, in raise_from_error raise cls(**kwargs) oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant)