Closed mammuth closed 2 years ago
Oh crap, you're right! I might be able to fix this later today, since this is a breaking bug.
Regarding debugging: Fitbit allows refresh tokens for localhost, so during development, I use a local instance for debugging.
When debugging, you can create a dev server:
./heedy create testdb
./heedy run testdb --development
This will create a database in testdb folder and run it in foreground
Regarding debugging: Fitbit allows refresh tokens for localhost, so during development, I use a local instance for debugging.
Oh no, I thought I tried that in the beginning but then I went down the rabbit hole of setting it up behind a reverse proxy just to get fitbit authenticated :see_no_evil: :laughing:
Thanks for you development tipps :+1:
I made a quick edit that might fix the issue. Would you be able to test it? If the fix works, then I'll release the update.
In the future, I will probably want to refactor a bit, so the timeseries isn't created if there is no elevation data.
Seems to mitigate the crash :+1:
INFO:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Syncing data for Max
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/heart/date/2021-03-14/1d/1sec.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/steps/date/2021-03-14/1d/1min.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/elevation/date/2021-04-03/1d/1min.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Error response: {"errors": [{"errorType": "validation", "fieldName": "resource path", "message": "Invalid time series resource path: /activities/elevation"}]}
WARNING:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:No data for elevation
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1.2/user/-/sleep/date/2021-04-03/2021-04-13.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/heart/date/2021-03-15/1d/1sec.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/steps/date/2021-03-15/1d/1min.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/elevation/date/2022-05-05/1d/1min.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Error response: {"errors": [{"errorType": "validation", "fieldName": "resource path", "message": "Invalid time series resource path: /activities/elevation"}]}
WARNING:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:No data for elevation
v0.1.1 is released. Hopefully, it fixed the issue!
The release includes another fix made a couple of minutes ago.
Your latest commit also works fine for me :100:
INFO:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Syncing data for Max M
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/heart/date/2021-05-05/1d/1sec.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/steps/date/2021-05-05/1d/1min.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/elevation/date/2021-04-03/1d/1min.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Error response: {"errors": [{"errorType": "validation", "fieldName": "resource path", "message": "Invalid time series resource path: /activities/elevation"}]}
WARNING:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:No data for elevation
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1.2/user/-/sleep/date/2022-05-07/2022-05-07.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/heart/date/2021-05-06/1d/1sec.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/steps/date/2021-05-06/1d/1min.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/heart/date/2021-05-07/1d/1sec.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/steps/date/2021-05-07/1d/1min.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/heart/date/2021-05-08/1d/1sec.json
DEBUG:fitbit:f053cea9-c750-43dd-a41b-fa1e51ac60e8:Querying: https://api.fitbit.com/1/user/-/activities/steps/date/2021-05-08/1d/1min.json
When the plugin syncs, Fitbitseems to return an error that isn't handled gracefully by the plugin:
Assumption: I have a fitbit device that does not track elevation, so fitbit simply doesn't have any elevation data.
Manually "removing" the elevation from
syncer.py
mitigates the issue and the other data is fetched correctly.I can try to look into fixing this issue, however, I'm still unsure how to setup heedy, especially for development, since I need an installation behind a https proxy to be able to get the fitbit refresh token (or I have it once now and try to just copy-paste the auth token from the "public" instance to a development instance :thinking: