Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resting HR Could be added to interday.gs #14

Open
jchristy13 opened this issue Apr 25, 2016 · 6 comments
Open

Resting HR Could be added to interday.gs #14

jchristy13 opened this issue Apr 25, 2016 · 6 comments

Comments

@jchristy13
Copy link

Note I have no idea what I'm doing on github so there's probably a not terrible way to document this correctly. Sorry.

The way I did this might be a little hacky, but it's definitely possible without too much trouble. It might be worth adding this - I know I was very interested in having this included, in addition to the other columns already there.

  1. Add "activities/heart" to LOGGABLES
  2. Include heartrate in setscope
  3. Add conditional within sync data population to check title != "heart"
    If true -> cell.offset(index, !dateColDone + activity * 1.0).setValue(val["value"]); (no change)
    If false -> cell.offset(index, !dateColDone + activity * 1.0).setValue(val["value"]["restingHeartRate"]);
@nickAtWybar
Copy link

nickAtWybar commented Jan 1, 2017

hey @jchristy13, if you're still around, could you please expand on #3? Where exactly in interday.gs do you place that line?
For now I'm getting an exception back from the api when I try to do #1 and #2:
[17-01-01 14:11:40:516 MST] Exception: Request failed for https://api.fitbit.com/1/user/-/activities/heart/date/2015-12-04/2017-01-01.json returned code 403. Truncated server response: {"errors":[{"errorType":"insufficient_scope","message":"This application does not have permission to access heart rate data. Visit https://dev.fitb... (use muteHttpExceptions option to examine full response)

@jchristy13
Copy link
Author

jchristy13 commented Jan 1, 2017

Did you authorize again? The changes in number 2 change the scope of what your spreadsheet is trying to request, so you have to do that before you try to sync or you'll get the error you mention. I think.

@jchristy13
Copy link
Author

jchristy13 commented Jan 1, 2017

To answer the question though, you need to add the third thing above line 283 in the original interday.gs file. It ends up looking like:

if ( title != "heart") { cell.offset(index, !dateColDone + activity * 1.0).setValue(val["value"]); } else { cell.offset(index, !dateColDone + activity * 1.0).setValue(val["value"]["restingHeartRate"]); } index++;

@nickAtWybar
Copy link

@jchristy13 thanks for the response - both suggestions were the cause of my issues. I can now download interday heartrate! Thanks for being so quick. Solved.

@naithani1
Copy link

naithani1 commented Mar 31, 2017 via email

@eiplanner
Copy link

I put this exact code starting on line 283:

if (title != "heart") { cell.offset(index, !dateColDone + activity * 1.0).setValue(val["value"]); 
} 
else { 
    cell.offset(index, !dateColDone + activity * 1.0).setValue(val["value"]["restingHeartRate"]); 
} 
index++

I performed items 1 and 2 of the enhancement. I then inserted this section of code. I then saved the new code and authorized it from the spreadsheet. I went into Fitbit setting and chose the "activities/heart" to download and saved those changes. When I click on sync, I get a white pop-up box that says "Error downloading avtivities/heart. If anyone still follows this thread, can you tell me what I am missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants