This is a bash script for getting weight data from the Fitbit Aria scales and loading it into Domoticz.

1) Register a new Fitbit app here: https://dev.fitbit.com/apps/new, the redirect domain also known as the "Callback URL" does not need to be real, the OAuth 2.0 Application Type is: personal, select read only access.

2) Copy your fitbit apps "OAuth 2.0 Client ID" and put it into the URL below along with your "Callback URL", then visit it using Google Chrome

https://www.fitbit.com/oauth2/authorize?client_id=ENTERYOURCLIENTIDHERE&redirect_uri=ENTERYOURREDIRECTURLHERE&response_type=code&scope=weight+activity+heartrate+location+nutrition+profile+settings+sleep+social
EXAMPLE of how it should look with the added "OAuth" and "Callback URL":
https://www.fitbit.com/oauth2/authorize?client_id=abc123&redirect_uri=https://domoticz.com&response_type=code&scope=weight+activity+heartrate+location+nutrition+profile+settings+sleep+social

When you get to the Fitbit page asking if you want to authorize your app, right click the page and select "Inspect", go to the "Network" tab in Google Chrome then proceed with allowing Fitbit to authorize the app. Look for ?code= in the "Network" tab url's you should see a 40 character long code, put it in the "code" configuration section of the bash script below.

3) Go back to your app https://dev.fitbit.com/apps and copy the client id, client secret and callback URL into the script Fitbit configuration section.

4) Create a new Virtual Sensor in Domoticz type "Scale (Weight)" and get its IDX code from the Domoticz devices page.

5) Enter the IDX number in the bash script, fill out the Domoticz configuration section and set the weight units in the script

To make this as simple as possible, you do not need to edit anything outside of the two lines that look like this:
# ----------------------------------------------------------------------------------

An alternate version is under development which is able to detect when the Fitbit Aria joins the WiFi network after standing on the scales and get the latest data within seconds. This is useful if for example you want an audio announcement in your home after a new weight is recorded: eg "Congratulations you have lost x kilograms". It is expected to be made available in the next few days.

weight.JPG (33.66 KiB) Viewed 1509 times

I use this bash script to start aria.sh and run it in the background using screen at startup:

Notes:
1) If you delete refreshtoken.txt you must repeat step 2 and enter the new code into the bash script.
2) The send to Domoticz curl command is set to accept unsigned SSL certificates which may be a security risk.
3) You need to understand and edit as needed the above script to work in your own environment.

Last edited by ben53252642 on Thursday 01 February 2018 14:52, edited 11 times in total.

The alternate version is now available (only different steps from the above script are listed, follow the original script for setup).

This version sits constantly searching for the Fitbit Aria and updates when it is detected. You can experiment with the "sleep 10" value in the "# Check to see if Fitbit Aria is online" section of the script which is the amount of time the system waits after the Aria is detected online before checking for the new weight from the Fitbit API.

1) Set the Fitbit Aria LAN static ip address in the script (you will also need to have your router configured to give the Fitbit Aria a static IP based on it's mac address

Notes:
1) It is not recommended to use this version if your Domoticz server is connected to your WiFi router / access point via wireless. The script relies on low latency to be able to detect the Fitbit Aria during the brief time that it is connected to the network.
2) Do not use this version if you know your Fitbit Aria has a poor WiFi signal. If an Aria can't connect when you step on the scales, it will store the result and try again later. In this case you may as well use the first version of the script.
3) My observation is that an Aria is usually detected within about 30 seconds however it can take up to around 10 minutes for an Aria to be detected if it fails to update on WiFi during the first attempt. That said I have yet to see the script fail to detect an Aria, be patient, best results are achieved with a good WiFi signal.

Different system unfortunately, if I had one of their scales I could try to create a Domoticz interface but for now I'm happy with the Fitbit Aria, it's very good quality. If your looking for a scale I suggest getting the Aria.

did you ever try to post data to the fitbit api?
i have a different brand scale that is already connected to domoticz but like to send that data to my fitbit profile

Not sure.

That said the Fitbit scales we're not expensive, I'm very happy with mine. Considering the amount of time it would take to create an interface (assuming it's even possible), I suggest thinking about switching to the Fitbit scale since there is an existing solution now for getting data into Domoticz.

did you ever try to post data to the fitbit api?
i have a different brand scale that is already connected to domoticz but like to send that data to my fitbit profile

Not sure.

That said the Fitbit scales we're not expensive, I'm very happy with mine. Considering the amount of time it would take to create an interface (assuming it's even possible), I suggest thinking about switching to the Fitbit scale since there is an existing solution now for getting data into Domoticz.

I use a medisana scale and blood pressure sensor, both connected through BT-LE with a raspi zero, works fine! so i already have the data in domoticz
so will try to push data to fitbit api.. when i read the api documentation, it must not be so hard when i use this script as start