Announcement

Collapse
No announcement yet.

FitbitSeer, a Fitbit plugin for HS3 - Need beta testers

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • FitbitSeer, a Fitbit plugin for HS3 - Need beta testers

    NEWS: FitbitSeer now supports OAuth2.0 and therefore now works after the removal of OAuth1.0a on August 1 2016.


    As a proof that it was possible to actually create a plugin without too much effort using my own plugin sample (currently in development, being released very shortly), I wrote a plugin to fetch data from Fitbit.



    My wife and I have Fitbit Ones and we use them 24 hours a day, even when we sleep. We have two girls, 2 and 4 years old, and the youngest is struggling with the last tooth (it's finally over soon!!!), so for us sleep is very important. (But as you can see, the last night wasn't bad at all! First time I've been sleeping through the whole night in two weeks).

    Fitbit will keep track on the last nights sleep, and HomeSeer will remind us to get to bed early if your sleep length or quality isn't satisfactory. If the quality and/or actual sleep time is bad enough and the TV is still on, it'll turn everything media related off.

    It'll also keep track on our internal daily step count contest.



    At the moment it's not very pretty or feature rich, but it should be stable.

    Authorization is oAuth-based. The plugin is based on Fitbit.NET which builds on the Fitbit API. The plugin will update data every 5 minutes, and this should be fast enough to be almost "live" as Fitbit devices aren't updated continously, and it's seldom enough so we don't cross the 150 requests pr hour rate limit. However, this refresh time is user configurable. The plugin is multi-threaded so checking more often shouldn't be a problem.

    Planned features:
    • User can select whitch data to fetch. Example: If you're not interested in sleep, then FitbitSeer will ignore sleep data.
    • Adding triggers and actions is of course possible, but I don't know which triggers and actions are needed...?
    • Possibly convert datafetch from poll to push making the plugin display "live" data, but this is not something needed right away.



    Intallation and updating is pretty straight forward, but a summary is given here:
    1. Updating from 0.1.x.x: Dispable the Fitbit plugin if it's running!
    2. Updating from 0.1.x.x: Remove the two dlls in /Bin/FitbitSeer
    3. Updating from 0.2.0.0x: You can delete the GIF-files in /html/Images/FitbitSeer
    4. Unzip all files to your HomeSeer directory, and overwrite
    5. Updating from 0.1.x.x:Updating from 0.1.x.x: Now open the root devices and go to the Fitbit tab. All accounts needs to be re-authenticated.
    6. Updating from 0.2.0.0: Open the root device, check the "Heartrate" checkbox at the bottom if you have a tracker that reads HR.



    READ THIS ABOUT AUTHENTICATION:
    Authenticating with HomeSeer requires a little "hack". I can't possibly know all the different IPs and ports used for HS, and having a valid return URL is required for OAuth2.0. So that's a problem. I set "http://localhost" as the return URL because then you will KNOW that I am NOT sending this code to anybody else, it is only for you (see privacy statement below). This will not resolve, unless you happen to have a web server (like HS) on the machine you are using. But the URL wont work in any case. We are not interested in the page, but in the URL itself. Here's an example of what you get after you click on the "Authenticate" URL, log in to Fitbit and hit OK:
    Code:
    http://localhost/?code=c821b14f9abdf90ec154140108f83e613e21e7c9#_=_
    Here we are only interested in the part between "code=" and "#_=_", that means the blue bit here:
    http:// localhost/?code=c821b14f9abdf90ec154140108f83e613e21e7c9#_=_
    Copy that bit, and paste it back into the text box in the device settings on the root. If successful, FitbitSeer will fetch your userID and display alot of checkboxes. Just hit "Done" at the bottom, because you are done.

    ... and one last thing:
    Authentication WILL FAIL WITH NO ERROR (at the moment) if there's a "Newtonsoft.Json.dll" in the HomeSeer directory or in the /Bin-folder (if it's in /bin/some_subfolder is fine, however). I encountered that problem when testing the plugin on my main system. Just a heads upp



    Privacy statement:
    I do not log anything at all. There's only (encrypted over HTTPS) communication between your HomeSeer installation and the Fitbit servers, nothing more (that I am aware of, anyway). I really, really don't care how active or little active you are, if you wear your heartrate monitor during sexy time, how much you weigh or how many bottles of water you drink every day.



    Changelog:
    0.2.0.10
    - Added heartrate devices, see image above.
    - New Fitbit.net library
    - New icons!

    0.2.0.0
    - OAuth2.0 conversion with Fitbit.NET 2.0 RC3. BETA!
    - You DO NOT have to remove any devices, all current devices will work!
    - I had to go back to 0.1.0.2 to make this work, so most of the new features I was planning are gone (for now).
    - Known bug: Logging is almost nothing, and I'll fix this soon. If you want to see what's going on, then stop the plugin, enable "Developer Mode" on to of the plugin management page, and restart the plugin. (Remember to uncheck the "Developer Mode" after restarting the plugin or you'll get a console window for each plugin the next time you restart HS!)
    - Known bug: I actually don't know if the check boxes on the root device -> Fitbit-tab works or not. I think they do, but I'm not sure.
    - Know "bug" (but unfixable): If FitbitSeer or HomeSeer is stopped for more than 8 hours, you will need to re-authenticate your accounts.

    0.1.0.1:
    - Added stair count
    - Hopefully corrected for imperial units
    - Corrected "Weight Weight". But please delete that device before upgrading (don't worry, it'll get recreated).
    - Moved the submenu lower on the Configuration page

    If you're upgrading then you just need the exe-file in the updated zip-file below.


    Comments are most welcome!
    If would be great if you give me a hint below if you test it.
    Attached Files
    Last edited by Moskus; November 27th, 2017, 06:42 AM.
    HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
    Running on Windows 10 (64) virtualized
    on ESXi (Fujitsu Primergy TX150 S8).
    WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

    Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

  • #2
    My wife and I also have FitBits. Will load this up over the week-end.

    Chris
    HSPRO3 3.0.0.368 on HP 8000, 9 SONOS, Vista p20 alarm, 3 IPads and HP Touch Screen, 22 z-Wave, 54 INSTEON

    Plugins :BLBackup:,Pushover 3P:,Wiimote:Winery,HSTV:,Insteon:,PHLocation:,drhsIpPlugIn:, UltraNetatmoWelcome3:,UltraSighthoundVideo3:,Vista Alarm:,UltraCID3:,Random:,EasyTrigger:,iAutomate RFID:,FitbitSeer:,Z-Wave:,HSTouch Server:,weatherXML:,Sonos:,Restart:,UltraGCIR3:,UltraPioneer AVR3:JowiHue;WiiMote;MyQ

    Comment


    • #3
      Nice job on the plug-in so far. I just got a Fitbit today so just figuring things out.

      Some notes so far...
      * My weight in Fitbit is 165 lbs., in Fitbitseer it's showing up as 74.7 lbs.
      * On the config screen the 'Submit' button for add new account is sitting in Homeseer's bottom tool bar (see picture)
      * Also, on the config screen I see how to Add an account but can we also get a list of current accounts and have the ability to remove one? I know it's beta but figured I'd throw the idea out there.

      Thanks for a nice way to keep track of the Fitbits. Look forward to seeing how this plug-in evolves.
      Attached Files
      Bryan
      Software/Hardware: Win10 Pro, HS 3 Pro, HS Touch, Echo, Edgeport/4, Z-Net w/88 Devices, Insteon PLM w/19 Devices, Nest, GC-100-6, W800RF32A, WS-2080 Weather Station (KMADRACU10)
      Plug-in/Scripts: Alexa API, BLBackup, BLGData, BLLED, BLLock, BLRF, BLTVGuide, Blue Iris, BLUPS, Current Cost 3P, DirectTV, FitbitSeer, Insteon, Nest, Pushover 3P, Random, Restart, Tasker, UltraGCIR3, UltraWeatherWU, Z-Wave

      Comment


      • #4
        Originally posted by TechHA View Post
        * My weight in Fitbit is 165 lbs., in Fitbitseer it's showing up as 74.7 lbs.
        Thanks for catching this. It appears that Fitbit, even if it's an american company, is using SI-units in their database. 165 lbs is 74.7 kg, so I will need to do some conversion. Thanks!

        May I ask you also to double check the "Distance"? Is it the same as it's listed on fitbit.com?


        Originally posted by TechHA View Post
        * On the config screen the 'Submit' button for add new account is sitting in Homeseer's bottom tool bar (see picture)
        Yes, it should be. I noticed that after publishing. I'll solve that later.


        Originally posted by TechHA View Post
        * Also, on the config screen I see how to Add an account but can we also get a list of current accounts and have the ability to remove one? I know it's beta but figured I'd throw the idea out there.
        Perhaps I should explan this:

        If you want to remove an account, just delete the root device for that account and all it's child devices. All the account data is stored in the root.
        HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
        Running on Windows 10 (64) virtualized
        on ESXi (Fujitsu Primergy TX150 S8).
        WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

        Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

        Comment


        • #5
          looks like a great way to start a "war" between my wife and I
          Will order 2 over the weekend and install plug-in
          Ubuntu 16.10 (64) | HSPro 3.0.0.297 | Z-Wave 3.0.1.124 | Server .94 | BL BackUp | BLOccupied | BLLock | Media Controller | Jowi HUE | HSTouch | DSC-Envisalink | I-Tunes DAAP | DirecTV | Restart | Honeywell WiFi | Weather XML | RFX Com | + Android .117 : IOS 8

          Comment


          • #6
            I hope everyone bought FIT stock as well as their gadgets. Up 50% on today's IPO!
            Unfortunately I did not.
            cheeryfool

            Comment


            • #7
              Originally posted by gearyt View Post
              looks like a great way to start a "war" between my wife and I
              Will order 2 over the weekend and install plug-in
              Plug-in installed, devices to be delivered Sat...
              Ubuntu 16.10 (64) | HSPro 3.0.0.297 | Z-Wave 3.0.1.124 | Server .94 | BL BackUp | BLOccupied | BLLock | Media Controller | Jowi HUE | HSTouch | DSC-Envisalink | I-Tunes DAAP | DirecTV | Restart | Honeywell WiFi | Weather XML | RFX Com | + Android .117 : IOS 8

              Comment


              • #8
                No fitbit here. I use my pebble for activity tracking.

                I am looking forward to checking out your example plugin code. . .:-)

                Comment


                • #9
                  Looks like the Distance is also off, as you thought. Fitbit website says: .37 miles and Fitbitseer says: .6 miles

                  Thanks
                  Bryan
                  Software/Hardware: Win10 Pro, HS 3 Pro, HS Touch, Echo, Edgeport/4, Z-Net w/88 Devices, Insteon PLM w/19 Devices, Nest, GC-100-6, W800RF32A, WS-2080 Weather Station (KMADRACU10)
                  Plug-in/Scripts: Alexa API, BLBackup, BLGData, BLLED, BLLock, BLRF, BLTVGuide, Blue Iris, BLUPS, Current Cost 3P, DirectTV, FitbitSeer, Insteon, Nest, Pushover 3P, Random, Restart, Tasker, UltraGCIR3, UltraWeatherWU, Z-Wave

                  Comment


                  • #10
                    I just installed and I'm very impressed for an initial beta. I can confirm that weight and distance are incorrect. The name of the weight device is "Chris Weight Weight".

                    I have a Charge HR and would like to add Stairs and Resting Pulse to the wish list for data to fetch.

                    Thoughts for triggers and actions... I'm currently using IFTTT to send me a text message if I haven't hit my steps or stairs goals by a certain time each day. It would be great if I could have HomeSeer prompt me to walk a bit more through the speaker interface. Another great use would be if Fitbit says I'm sleeping, put the house in sleep mode.

                    I originally got a Fitbit when they first came out to track my sleep and got hooked on all of the other data. I moved to a Beddit about a year ago for sleep tracking - it provides a more detailed analysis of your sleep and you don't have to wear anything.

                    Thanks for writing this plugin and I look forward to its evolution!

                    -Chris

                    Comment


                    • #11
                      Hi everyone, and thanks for testing!
                      I'll get a new version out today with the most urgent bug fixes (such as metric vs imperial conversion, and "weight weight").



                      Originally posted by TechFan View Post
                      No fitbit here. I use my pebble for activity tracking.

                      I am looking forward to checking out your example plugin code. . .:-)
                      I didn't even know Pebble could do activity tracking. It's a "Pebble Time", right? As I'm pretty sure my Kickstarter Pebble can't do that.

                      I'm always wearing three devices. My phone (Lumia 930), my Pebble and my Fitbit One.


                      Originally posted by TechHA View Post
                      Looks like the Distance is also off, as you thought. Fitbit website says: .37 miles and Fitbitseer says: .6 miles
                      Thanks!

                      Originally posted by cjohlandt View Post
                      I just installed and I'm very impressed for an initial beta. I can confirm that weight and distance are incorrect. The name of the weight device is "Chris Weight Weight".

                      I have a Charge HR and would like to add Stairs and Resting Pulse to the wish list for data to fetch.

                      Thoughts for triggers and actions... I'm currently using IFTTT to send me a text message if I haven't hit my steps or stairs goals by a certain time each day. It would be great if I could have HomeSeer prompt me to walk a bit more through the speaker interface. Another great use would be if Fitbit says I'm sleeping, put the house in sleep mode.

                      I originally got a Fitbit when they first came out to track my sleep and got hooked on all of the other data. I moved to a Beddit about a year ago for sleep tracking - it provides a more detailed analysis of your sleep and you don't have to wear anything.

                      Thanks for writing this plugin and I look forward to its evolution!

                      -Chris
                      Fitbit.NET haven't made fetching data for "stairs" easy, we use it alot so I would love to get that into the plugin. I may have to build my own datafetcher for that, but I'm hoping to avoid it. The same goes for "Resting pulse".

                      However, I don't think it's impossible, it's just a matter of knowing where to look. We might have to test a little bit (I don't have a HR so "Resting pulse" isn't available to me), but we'll try. Instead of sending beta-versions of the plugin, I might just send you a single exe-file. You run it and paste the data to me.


                      Triggers and actions:
                      So far I haven't done anything special with those, as I can't imagine a scenario not covered by the options already offered by HomeSeer. All the devices are populated with device values and can therefore be used as triggers or conditions.

                      Here's a brief description of the device values:
                      - Active minutes: The sum of "fairly active" and "very active" (the same as the Fitbit apps)
                      - Calories burned: Self explanatory
                      - Distance: ...
                      - Steps: ...
                      - Speep start / end: The sum of hour * 60 + minutes
                      - Quality: Just the "Efficiency" in a range from 0 to 100 (percent)
                      - Time asleep: Total minutes
                      - Time in bed: Total minutes
                      - Weight: ...

                      So if you want a condition set to something like "IF time slept is less than 7 hours", it should be set "this device has a value less than" and the value is 420 (7*60).

                      We've been using Fitbit for sleep tracking when we got the Ones, in desember 2013. So we have 2.5 years of sleep data. While not perfect, it still gives a "guesstimate" on how the night was. However, I've ordered a Luna bed cover to take care of this, and a user here says he has ordered the SDK version so he can write a plugin for that as well.
                      HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
                      Running on Windows 10 (64) virtualized
                      on ESXi (Fujitsu Primergy TX150 S8).
                      WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

                      Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

                      Comment


                      • #12
                        Yes, there are at least two apps for the original (what I have) that do tracking. Misfit and another, plus I use Morpheuz for sleep tracking and smart alarm (wake up while you are already moving during a range). And of course the pebble app to control HS.


                        Sent from my iPad using Tapatalk

                        Comment


                        • #13
                          OK, I've been digging a little more in the Fitbit API and the dataset is HUGE! Yes, all the data is there. It's just a matter of finding the correct data.
                          HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
                          Running on Windows 10 (64) virtualized
                          on ESXi (Fujitsu Primergy TX150 S8).
                          WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

                          Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

                          Comment


                          • #14
                            Just installed FitbitSeer 0.1.0.1.

                            Some things I noticed:
                            * Weight and Distance are now correct for lbs and miles.
                            * Add user button is out of the toolbar and looks much better
                            * Weight Weight is fixed

                            Great update!
                            Bryan
                            Software/Hardware: Win10 Pro, HS 3 Pro, HS Touch, Echo, Edgeport/4, Z-Net w/88 Devices, Insteon PLM w/19 Devices, Nest, GC-100-6, W800RF32A, WS-2080 Weather Station (KMADRACU10)
                            Plug-in/Scripts: Alexa API, BLBackup, BLGData, BLLED, BLLock, BLRF, BLTVGuide, Blue Iris, BLUPS, Current Cost 3P, DirectTV, FitbitSeer, Insteon, Nest, Pushover 3P, Random, Restart, Tasker, UltraGCIR3, UltraWeatherWU, Z-Wave

                            Comment


                            • #15
                              Very cool!

                              Just tweeted this thread!

                              https://twitter.com/HomeSeer/status/612021121953759232
                              website | products | support | youtube

                              Comment

                              Working...
                              X