omriasta / ifitsync Goto Github PK
View Code? Open in Web Editor NEWPython script to sync iFIT data to your Google Fit Account
License: GNU General Public License v3.0
Python script to sync iFIT data to your Google Fit Account
License: GNU General Public License v3.0
This is a fantastic project!
For anybody interested, this is implemented in Docker by cloning this Repo, obtaining the token.pickle file and copying it into the directory then using the following Dockerfile:
FROM python:3.8-slim-buster
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install dependencies:
COPY requirements.txt .
RUN pip install -r requirements.txt
# Run the application:
RUN mkdir /ifitsync
WORKDIR /ifitsync
CMD ["python", "ifitsync.py"]
After building the image, run it with the following command:
docker run -d --name ifitsnyc -v ~/ifitsync:/ifitsync <image name>
Hello,
Installed on Win10 with python 3.12 I had to modify the requirements.txt to set lxml to 5.1.0 but not a gig deal
Google API is set up and the credentials.json is working with a quickstart project.
Here it is asking for ifit.com account and the crash.... Sorry Yes I have a nordiktrack bike.
Thanks for your help.
C:\Users\franc\GIT\ifitsync>python ifitsync.py
iFit Username(email):
SomeAccount
Password:
Traceback (most recent call last):
File "C:\Users\franc\GIT\ifitsync\ifitsync.py", line 2, in
from get_ifitaccount import HISTORY_JSON, IFIT_HIST_HEADERS
File "C:\Users\franc\GIT\ifitsync\get_ifitaccount.py", line 101, in
CLIENT_ID = clientid_list[0]
~~~~~~~~~~~~~^^^
IndexError: list index out of range
What changes to the code would be necessary to use this with a NordicTrack stationary bike? I like the idea of using it to sync my rides with iFit :)
I have already updated the scopes in the script, so remember to run git pull first. If you have previously run this script, you will need to delete token.pickle and run the script to reauthorize the script with your google account and receive the new permissions.
After that the script will work again.
Hi, came across your project, it looks great but I'm having trouble logging into iFit when running python ifitsync.py
.
I enter my iFit email and password and it returns:
Traceback (most recent call last):
File "ifitsync.py", line 2, in <module>
from get_ifitaccount import HISTORY_JSON, IFIT_HIST_HEADERS
File "/home/pi/ifitsync/get_ifitaccount.py", line 98, in <module>
clientid_list = re.findall(regex_clientid, scripts[0].text_content())
IndexError: list index out of range
I created my iFit account using Google credentials.
I get this error when uploading a workout. I believe this is a workout that was captured in the ifit app on a phone rather than from a treadmill itself. Here is the actual error output:
Uploaded Body Weight HIIT Workout Calorie data successfully
Traceback (most recent call last):
File "ifitsync/ifitsync.py", line 691, in
UploadIfitDistanceToGoogle(y)
File "ifitsync/ifitsync.py", line 314, in UploadIfitDistanceToGoogle
+ IfitWorkoutJson.lists["meters"][0]["offset"] * 1000000,
IndexError: list index out of range
I'm having a hard time figuring out which value Google isn't liking. Do you mind pointing me in the right direction?
I have noticed that steps and heart points are not showing up when I upload a workout but if I change the scripts timestamp and upload the workouts a second time after a couple of hours, then these stats do eventually populate.
I am not sure if this is an issue with the script or if google fit is enacting some changes...
Not sure if anyone else is noticing or wants to take a look to see if they can figure out why this is happening?
I'm getting the following error after a few days when I run the cron job every 6 hours. When I refresh the pickle file via GUI, it works again for a few days. It seems the script is not updating the token after it runs.
Traceback (most recent call last):
File "ifitsync.py", line 25, in
service = main()
File "/ifitsync/get_googleaccount.py", line 39, in main
creds.refresh(Request())
File "/opt/venv/lib/python3.8/site-packages/google/oauth2/credentials.py", line 200, in refresh
access_token, refresh_token, expiry, grant_response = _client.refresh_grant(
File "/opt/venv/lib/python3.8/site-packages/google/oauth2/_client.py", line 248, in refresh_grant
response_data = _token_endpoint_request(request, token_uri, body)
File "/opt/venv/lib/python3.8/site-packages/google/oauth2/_client.py", line 124, in _token_endpoint_request
_handle_error_response(response_body)
File "/opt/venv/lib/python3.8/site-packages/google/oauth2/_client.py", line 60, in _handle_error_response
raise exceptions.RefreshError(error_details, response_body)
google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', '{\n "error": "invalid_grant",\n "error_description": "Token has been expired or revoked."\n}')
Traceback (most recent call last):
File "ifitsync.py", line 25, in
service = main()
File "/ifitsync/get_googleaccount.py", line 39, in main
creds.refresh(Request())
File "/opt/venv/lib/python3.8/site-packages/google/oauth2/credentials.py", line 200, in refresh
access_token, refresh_token, expiry, grant_response = _client.refresh_grant(
File "/opt/venv/lib/python3.8/site-packages/google/oauth2/_client.py", line 248, in refresh_grant
response_data = _token_endpoint_request(request, token_uri, body)
File "/opt/venv/lib/python3.8/site-packages/google/oauth2/_client.py", line 124, in _token_endpoint_request
_handle_error_response(response_body)
File "/opt/venv/lib/python3.8/site-packages/google/oauth2/_client.py", line 60, in _handle_error_response
raise exceptions.RefreshError(error_details, response_body)
google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', '{\n "error": "invalid_grant",\n "error_description": "Token has been expired or revoked."\n}'
I get both the iFit and Google Fit authentication working and then I get this error. I hope maybe I'm missing something. I tried creating empty 'last_run_time.json' file but that did not work.
Traceback (most recent call last): File "ifitsync.py", line 674, in <module> with open('last_run_time.json') as timestamp_file: FileNotFoundError: [Errno 2] No such file or directory: 'last_run_time.json'
Is a premium membership required through iFit to transfer all access/sync all of the data?
I haven't used the iFit app that much so I'm not extremely familiar with it.
I appreciate the project, thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.