As our kids get older, they’ve started to develop an interest in having a wearable – and as parents, we’re happy to support this as it allows us to help have conversations around healthy behaviours, especially as the desire for screen time also increases.
Over the holidays, we all got kitted out with a variety of Fitbit wearables (not the fancy ones, just simple displays) – however I was left with a challenge, how can I get this data into Home Assistant so it can be displayed on our family dashboard?
Unfortunately, the native Fitbit integration only supports a single account, which wouldn’t work for us. While I found some methods to get the data into Fitbit using various hacks, I didn’t want to be doing too much customisation of my Home Assistant sensors in case a breaking change made it stop working.
I had seen various Power Automate solutions getting data from Fitbit with custom connectors, but unfortunately it would require a premium connector as I’d need to make calls to 4 separate Fitbit developer accounts.
I am lucky enough however to receive an Azure credit every month, and because Azure Logic Apps are similar to Power Automate – I was able to use the same approach to make it work. However, the solution ends up costing about 50c per week to run.
What I opted for, was to create a REST sensor in Home Assistant that would trigger an Azure Logic App workflow every 30 minutes to retrieve the data.
The workflow queries each person’s Fitbit developer account, retrieves the data I want (minutes and steps) and packages it up in an array.
The result is displayed in a Home Assistant dashboard like so:
(Don’t judge us, this screenshot was taken early in the morning.)
Getting access to your Fitbit data
I won’t go into the detail here, as this video contains everything you need to know for the process: Jon Does Flow: Fitbit Custom Connector for Power Automate – YouTube
In my scenario, I created 4 separate Azure logic apps custom connectors to perform the data retrieval.
The swagger of these connectors is as follows:
You can access the file from here.
Combining all accounts into a single set of data
The workflow is not the most elegant, but it works. Here is how it looks:
The scope for each person:
The response back to Home Assistant:
The full workflow can be downloaded from as an exported template.
Make note of where I have put in placeholder text such as <FITBIT ID> and <AZURE SUBSCRIPTION ID> and replace them with your own IDs.
Getting Home Assistant to retrieve the data
Over in Home Assistant we need to define the REST sensor. In this sensor we’ll need to include the URL from the Azure Logic App trigger, the frequency of updates (in seconds), as well as the JSON attributes being returned by the workflow:
The text of this sensor is available here.
Getting Home Assistant to separate the data
Unfortunately, when the data is returned from the Azure Logic App to Home Assistant, it will be a single blob with cascading arrays.
As I wanted to visualise these in a dashboard for each person, I needed to create separate sensors with their particular information as attributes. I used the following template structure for each person:
The text of this template is available here. Repeat as many times as you have defined in the workflow.
Displaying the data in Home Assistant
Finally, to make this present nicely I opted for the dual gauge custom card.
I also chose to display our photos and names in vertical stacks for a bit of personalisation but have omitted the code from here.
The text for these cards is available here.
And there you have it!
I also added the “last updated” data so we could see how current the displays where.
All the code for this solution is available from my GitHub repo.
Also published on Medium.