# Fitbit nodes - working?

**URL:** https://discourse.nodered.org/t/fitbit-nodes-working/55520
**Category:** General
**Created:** [21 December 2021 11:26 UTC](https://discourse.nodered.org/t/fitbit-nodes-working/55520 "2021-12-21T11:26:04Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![borpin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/borpin/32/1765_2.png) [@borpin](https://discourse.nodered.org/u/borpin)
#### Post date: [21 December 2021 11:26 UTC](https://discourse.nodered.org/t/fitbit-nodes-working/55520/1 "2021-12-21T11:26:04Z")

</div>

Continuing the discussion from [Fitbit - anyone have it working with node red?](https://discourse.nodered.org/t/fitbit-anyone-have-it-working-with-node-red/47150):

There are a couple of nodes available for Fitbit.

Has anyone got either of them working recently?

Neither node seems to have had any love recently judging by the release dates.

---

<div class="post-metadata">

### Author: ![borpin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/borpin/32/1765_2.png) [@borpin](https://discourse.nodered.org/u/borpin)
#### Post date: [22 December 2021 11:24 UTC](https://discourse.nodered.org/t/fitbit-nodes-working/55520/2 "2021-12-22T11:24:01Z")

</div>

In answer to my own question, I have found the following -

The 'official node' ([node-red-node-fitbit (node) - Node-RED](https://flows.nodered.org/node/node-red-node-fitbit)) does not seem to want to authenticate. it looks like it is old (last release says nearly 12 years) and FitBit have updated their authentication methods. Maintainer is listed as @dceejay but that may be as it is also part of a wider set of flows.

There is a contrib node ([node-red-contrib-fitbit (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-fitbit)) but again has not had any updates recently. It may work, but I could not get the right callback URL.

However, there is a fork of the contrib node ([GitHub - inglevir/node-red-contrib-fitbit](https://github.com/inglevir/node-red-contrib-fitbit)) which does work and has had some recent updates to it.

You do need to set your Node-RED instance up using https, but other than that the authentication worked first time and it usefully provides the correct callback URL.

Is there any appetite to get a 'core' node working well and develop the data recovered from the API? My JS is not up to it, but happy to test 🙂 .

I'd also like to write data to FitBit as well.

The forked node does what I need right now (which was to get the Battery Level) so I can trigger some reminders to charge/take off charge which was my primary driver at the start of this.

[edit]  
After more investigations, it is clear these nodes are designed to work with an old API that only probably still works as it is a legacy format. Take a list of activities (API Docs [Get Activity Log List](https://dev.fitbit.com/build/reference/web-api/activity/get-activity-log-list/)) the API docs suggest the URL should be of a format such as;

`https://api.fitbit.com/1/user/-/activities/list.json?afterDate=2019-01-01&sort=asc&offset=0&limit=2`

The forked node is generating a URL like (ignore the distance parameter)

`https://api.fitbit.com/1/user/-/activities/distance/date/2021-12-22/7d.json`

I suspect changing the format _might_ be relatively easy if I understood enough JS. I think probably the nodes need an extensive update to match the API.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [23 December 2021 10:39 UTC](https://discourse.nodered.org/t/fitbit-nodes-working/55520/3 "2021-12-23T10:39:19Z")

</div>

Indeed - the "core" node was contributed to the project by a small team at IBM many years ago. I don't have a fitbit (and have no interest in getting one) so the node is just sitting there as part of that larger collection. I guess we should really delete/remove it... but if you feel like playing with it and trying to update it then we would be very grateful. More than happy for you to take it as a learning exercise. It certainly can't be more broken than it is already 🙂

---

<div class="post-metadata">

### Author: ![borpin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/borpin/32/1765_2.png) [@borpin](https://discourse.nodered.org/u/borpin)
#### Post date: [23 December 2021 10:45 UTC](https://discourse.nodered.org/t/fitbit-nodes-working/55520/4 "2021-12-23T10:45:48Z")

</div>

I suspect what I primarily need is someone to help with a template on how to create the right URLs based on the input selections. I can work out most of what is going on but not how the actual URLs are generated (so moving from a `/xxx/` to a `&xxx=` format).

I think moving it out of this combined contrib node might be a good idea and making it standalone. I'd be happy to be guided on how to make a contribution to it. I think the fork I mentioned above would be the best place to start as the authentication does actually work.

---

<div class="post-metadata">

### Author: ![borpin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/borpin/32/1765_2.png) [@borpin](https://discourse.nodered.org/u/borpin)
#### Post date: [13 January 2022 22:30 UTC](https://discourse.nodered.org/t/fitbit-nodes-working/55520/5 "2022-01-13T22:30:09Z")

</div>

If anyone is interested I have created an updated node and called it fitbit2 as it is probably not backward compatible.

Works better with the HA Node-RED addon (key task), extended the API EndPoints serviced and improved the help/documentation.

Still needs some more work, but functional for now.

> **[GitHub - borpin/node-red-contrib-fitbit2](https://github.com/borpin/node-red-contrib-fitbit2)**
>
> Contribute to borpin/node-red-contrib-fitbit2 development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [14 March 2022 22:30 UTC](https://discourse.nodered.org/t/fitbit-nodes-working/55520/6 "2022-03-14T22:30:33Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
