Since it’s more of a feature request… also tagging @CCOSTAN who originally found issue with the current setup. Succinct example showing use of config filename. Longer example via Hue.
What I’m unsure on, is if Home Assistant has any other components or platforms that require multiple auth flows.
I created a branch which implements support for multiple trackers. I need to test it a bit more. If anybody is willing to give it a try, here is the branch:
Just make sure i have things right here. I need to get the fitbit component from agners home assistant repo and add it to our own custom_components, setup the new configs per @chris6’s example, and then restart hass?
Hmm, I dont think its loading the custom_component for me because im getting this error:
Invalid config for [sensor.fitbit]: [name] is an invalid option for [sensor.fitbit]. Check: sensor.fitbit->name. (See ?, line ?).
Invalid config for [sensor.fitbit]: [name] is an invalid option for [sensor.fitbit]. Check: sensor.fitbit->name. (See ?, line ?).
Detected use of deprecated `base_url` property, use `homeassistant.helpers.network.get_url` method instead. Please report issue to the custom component author for fitbit using this method at custom_components/fitbit/sensor.py, line 316: hass.config.api.base_url, FITBIT_AUTH_CALLBACK_PATH
Detected use of deprecated `base_url` property, use `homeassistant.helpers.network.get_url` method instead. Please report issue to the custom component author for fitbit using this method at custom_components/fitbit/sensor.py, line 218: start_url = f"{hass.config.api.base_url}{FITBIT_AUTH_START}"
Trying to remember the exact steps I followed to get it to work, it was a while ago I did it! Install and setup the original Fitbit component. This gives you file called fitbit.conf in HA folder. I renamed it to fitbit_eoin.conf, I then added a link to that newly renamed file to configuration.yaml
I then copied the files from agners repo into custom_components and restarted. This resulted in HA detecting a new fitbit integration. I ran through the exact same steps as the original setup which again resulted in fitbit.conf being created. I renamed this one too fitbit_mahiri.conf and added the following to configuration.yaml
I suspect you could repeat this process as many times as you like if you want more than 2 connections. Since doing it I have data coming in for both fitbit accounts without any issues.
Its not perfect yet (dont have my wifes account added yet, but my fitbit sensors are coming in as sensor.weight, so nothing custom to me and i see that being a problem). i had to update for it to work with the http external_url config of home assistant as base_url isnt supported anymore and i have a different internal/external ur (nginx proxy).
Did yours correctly setup a unique name for each fitbit sensor that is associated with the ‘name’ conf value or is it just doing something like sensor.weight and sensor.weight_2?
Are you able to scrape info about foods/log/caloriesIn and foods/log/water?
It would be nice to have that data available in a sensor for automations that reminded if the alloted calorie intake for a day has been exceeded or if you need to drink more water to reach your goal.
Added this two lines to your sensor.py and they seem to have done the trick.
Invalid config for [sensor.fitbit]> : [name] is an invalid option for [sensor.fitbit]. Check: sensor.fitbit-
name. (See ?, line ?).
Invalid config for [sensor.fitbit]: [name] is an invalid option for [sensor.fitbit]. Check: sensor.fitbit->name. (See ?, line ?).
I have fitibt folder frm @agners repo in my custom_component folder. But it seems it doesnt work for some reason. Are there any other settings required to set it up?
Standard fitbit integratino for just one user works just fine
I’ve just set this up today and ran into the issue that you’ve described.
I seem to have sorted it by naming the new integration folder in custom_components fit_bit and then changed the platform in sensor config to fit_bit.
Hope that helps!
It’s basically a merge between the current official fitbit sensor and @agners one but with some updates about the external_url (I use nginx reverse proxy and I cannot set internal_url same as external one)
Hope this helps !
NB: if you configure sensor with, for example, name: test, the integration will produce sensors prefixed by test_, for example sensor.test_steps
jncanches
I thought: I give it a try.
After succesfully adding my wife’s account, I could not register my own account on fitbit.
After the first step I got the warning: 500 Internal Server Error Server got itself in trouble.
After a second new retry, i got the callback file downloaded. “Fitbit has been successfully authorized! You can close this window now!”
But it did not safe anything in my own config file, and I have to configure it. (again)
It did not work.
I will give it another try in the weekend!
Weird.
I had a different problem with the URL generated in the last step. The redirected URL parameter still contains the internal_url. Editing it in browser address bar with the external one does the job.
Hope some devs will review this integration to make it more reliable.