** Update March 2nd 2018 **

Documentation is extended, scripts will now create the Homeseer virtual devices automatically and icons are added.

Unfortunately after several years my Oregon body weight scale died. It drained many batteries the last months which is very uncommon, and even the last reading were not picked up anymore my RFXCOM. When I shake the scale in the air, you will hear many looseparts…time to find a new one.

A must have is a connection to my smart home, preferable via wifi and not via bluetooth. Another challenge will be retrieve the data into Homeseer. Most of the brands provide a free dashboard, even an API. I’m still struggling with API’s, so for now I connected it to IFTTT. I prefer no connection to the outside world, but for a non security system device, it is oke.

Let’s start

First create a new applet on IFTTT.com for Fitbit and connect it to a Dropbox account.

  1. When a new weight is logged on Fitbit, IFTTT will update a text file in my Dropbox folder with the new weight value, see example below:

IFTTT-Fitbit

2. From the download at the bottom of the page, copy the “Fitbit” folder (with the icons), to the following location: “\Homeseer HS3\html\images\”

3. Copy both vb scripts to the following location: \Homeseer HS3\Scripts

The Fitbit-Aria.vb script will do the following:

  • It will create 4 virtual device in Homeseer 3: Weight, BMI, (weight) difference and File update.
  • It reads the value from the Dropbox text file and compare it to the the last saved value in MySQL table.
  • It will do some calculations, like the weight difference between the old and the new value and calculate the new BMI.
  • It will save the new device values to Homeseer
  • It deletes the text file on Dropbox
  • It store the new devices values to MySQL (In case there is already data saved today to the MySQL table, no new updates will be done.).

Screenshot of the created devices in Homeseer:

fitbit-aria2

4. Open your MySQL environment.

Create the table from the screenshot below manually or use the sql file from the download to do the import in MySQL(1 row is already added as an example). In the end you should have this:

fitbit-mysql-columns

5. Create an recurring Homeseer event, to run the “Fitbit-aria.vb” script (in my case the script will check every 30 minutes for the file in the local Dropbox\IFTTT folder):

Fitbit-event-Dropox-script

 

6. Create a second event (to store the final weight, bmi results). I prefer to have a seperate script for this, which is manually triggered by the Fitbit-Aria.vb script):

Fitbit-event-SaveTo-MySQL

In the end the “MySQL_Weight.vb” script will update the data in the table:

fitbit-mysql-table

 

7. Open the “Fitbit-Aria.vb” script, and change the following data, related to your environment:

Line 39-43:

  • Dim server = “localhost”
  • Dim user = “xxxxx”
  • Dim password = “xxxxx”
  • Dim database = “xxxxx”
  • Dim table = “weight”

The location of the local Dropbox textfile in lines 173, 192 and 202:

  • If My.Computer.FileSystem.FileExists(“D:\Dropbox\IFTTT\fitbitweight.txt”) Then
  • Dim Ariafile as New StreamReader(“D:\Dropbox\IFTTT\fitbitweight.txt”)
  • FileToDelete = “D:\Dropbox\IFTTT\fitbitweight.txt”

Line 48:

  • Dim personlength = “1,93”

 

 

8. Open the “MySQL_Weight.vb” script and change the following data, related to your environment:

Line 21:

  • Dim person as String = “Rutger”

 

Lines 24-28:

  • Dim server = “localhost”
  • Dim user = “xxxxx”
  • Dim password = “xxxxx”
  • Dim database = “xxxxx”
  • Dim table = “weight”

 

9. The MySQL.Data.dll file is added to the downloads as well. Put this file in the root of the Homeseer folder. The “settings.ini” file in the \Config folder has to be changed for this as well. If not done already:

  • Stop Homeseer 3
  • Edit the settings.ini file with the following data: “ScriptingReferences=MySql.Data.MySqlClient;MySql.Data.dll” (comma seperated with mutiple entries)and save the file
  • Start Homeseer 3

 

In the End, run the earlier created event with the “Fitbit-Aria.vb” script once. The devices are created automatically and if it’s a recurring event, you don’t have to take care about it anymore. In both scripts you may decide to change the Debug value to “false”.

 

Downloads:

Last release: 04-03-2018:

  Fitbit.zip (60.7 KiB, 373 hits)

  MySql.Data.zip (172.5 KiB, 361 hits)

Related Posts

Privacy Preference Center