Can someone explain the fitbit integration?

The documentation on Fitbit - Home Assistant (home-assistant.io) is quite limited and does not explain a lot, so I am left guessing what to do. I edited the configuration.yaml. I think I created a developer account (going to Fitbit SDK does not provide any login, but when I went to https://studio.fitbit.com/ i could create an app.

According to the integration page, I should:
“Restart Home Assistant once this is complete. Go to the frontend. You will see a new notification for configuring Fitbit.”

But what is “the frontend”?? If I go to the Homeassistant page I dont see any notification or anything. There is no error in the log regarding fitbit.

I’m having the exact same issue. No errors, config fine and double-checked. No notification of any kind to continue the configuration.

Running latest Docker image.

hmm, after tinkering around a bit, I finally managed to do it. But I am trying to see how I did it (was doing a lot of other stuff at that time) and cant even understand how I did it. I dont see fitbit in my integration page, but I do see it now under entities.

Not sure why they made this integration so different to all the other integrations, its really impossible to use it with the very limited documentation page.

What I do see, is that the correct page to create your app at fitbit is this link: Applications (fitbit.com)

Ok I figured it out also. The main problem is that the documentation on the Fitbit integration page is terrible.

  1. You have to be connecting to HA with https. (not mentioned)

  2. You have to have the instance named correctly under Settings → network → local network with the https url (not mentioned)

  3. You have to edit the fitbit.conf file, which is easy but there’s no mention that the file already exists. I spent a lot of time trying to find an example of that file when all I really had to do was open it and enter the info. It should be mentioned that the file was created by the fitbit integration at the correct location and that it is already set up except for the values you must enter.

  4. It errors because when you click the button on the fitbit site to allow the integration, it redirects to your HA instance, which prompts you to download the callback. Obviously the callback isn’t configured correctly. There is no indication on the fitbit site or anywhere else that it was successful.

  5. There is no mention that you have to restart at least twice.

Once you’re done, the various data you set up in the main config file are listed as entities. You can then add them to your dashboard, etc.

2 Likes

wow, nice write up! And yes I do remember that fitbit.conf file to also be a major issue for me. I hope whoever manages Fitbit - Home Assistant (home-assistant.io) will see your post and update that page.

1 Like

What does your fitbit.conf look like? Mine wasn’t created or setup, and I have no idea how to format the two values.

My fitbit.conf looks like this

{
  "access_token": "[access token]",
  "refresh_token": "[refresh token]",
  "client_id": "[client id]",
  "client_secret": "[client secret]",
  "last_saved_at": 1679464765
}

@HTX I noticed that the documentation is just a wiki so we could modify it ourselves. But I cant really reproduce the steps fully anymore to write a good explanation there. Do you still have the full overview?

Where do you get the:

{
  "client_id": "CLIENT_ID_HERE",
  "client_secret": "CLIENT_SECRET_HERE"
}

from?

you get the client id/secret from
https://dev.fitbit.com/apps

1 Like

Might be a dumb question but where to get the other parts?

{
“access_token”: “[access token]”,
“refresh_token”: “[refresh token]”,

I just went through this. After you complete the configuration and authorize the app access, the tokens are populated in fitbit.conf automatically by the integration.

Hi there, I´m also trying to get the fitbit integration working and it seems to be impossible following the “official” documentation :frowning:

This is the status quo:

  • I´m using cloudflare to connect to my HA which has a SSL connection.
  • I added the configuration to configuration.yaml as documented
  • I created an App within the Fitbit developer account
  • I entered the Client ID + client secret in the fitbit.conf
  • A fitbit entity (configurator.fitbit) is showing up in my system

Now, when trying to authorize the integration, I come to a page telling me that

“Developer information: invalid_request - Invalid redirect_uri parameter value”

Did anybody had a similar problem?

Same here. Running SSL with a wildcard SLL certificate. Set up the App within the Fitbit developer account, and entered the Client ID & secret. I get the same error:

“Developer information: invalid_request - Invalid redirect_uri parameter value”

local and internet URL point to FQN with https:// prefix

rebooted multiple times
also tried adding a trailing"/" to the redirect url in the developer account per other threads.

config yaml file as follows:

sensor:

  • platform: fitbit
    clock_format: 12H
    unit_system: en_US
    monitored_resources:
    • “body/weight”

Did you figure this out? I’m at the same point.

Nope - Didn´t find a way to get it going

OK I got it working…

  1. Update configuration.yaml with (more sensors can be added than the two listed):
sensor:
  - platform: fitbit
    clock_format: 24H
    monitored_resources:
      - "body/weight"
      - "activities/activityCalories"
  1. I had an existing fitbit.config folder that I deleted, then restarted HA. This recreates the fitbit.config.

  2. Go to Entities and you should find one called Fitbit. Click on it and then go to Info. There should be instructions here to follow… Including, go to Login, make sure Application Type is Personal. Set Callback (Redirect URL) is your https://[your_HA].ui.nabu.casa/api/fitbit/callback
    Then go update fitbit.config file with Client ID and Secret. Others have mentioned Access and Refresh Tokens but these get automatically added later.

  3. After Clicking I HAVE SAVED CLIENT ID AND SECRET, a new Fitbit entity should load. Go into it, then info again and there should be a link to follow to Authorize Fitbit. Following that link, selecting all and clicking ALLOW cause a file to download but I just went back to HA and clicked I HAVE AUTHORIZED FITBIT.

  4. Restart HA and entities should load. I had 1 entity load without restarting, then after restart they were all there.

Hopefully this works!

Thanks much for sharing @d2blake! Unfortunately, I´m not using Nabu Case so I´m afraid this won´t work for me :frowning:

in case you hold a domain you can use, you could then also run it via Cloudflare.
if not you can buy yourself a cheap domain *e.g. godaddy or directly at cloudflare and set a direct, encrypted https access to your home assistant.

Thanks @Kuechenfenster for the reply. In fact I´m already using Cloudflare. I tried to set up the fitbit integration again but now, not even the fitbit entity is showing up in my HA anymore :roll_eyes:

So thats the configuration for my configuration.yaml:

# Fitbit
sensor:
  - platform: fitbit
    clock_format: 24H
    monitored_resources:
      - "activities/calories"
      - "activities/steps"
      - "activities/distance"

This is in the fitbit.conf:

{
  "client_id": "23XXXX",
  "client_secret": "db4bXXXXX"
}

And thats how I configured the fitbit App:

Any one an idea where might be the problem?