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

No sleep data in database #150

Open
sunshineRunner22 opened this issue Feb 15, 2022 · 10 comments
Open

No sleep data in database #150

sunshineRunner22 opened this issue Feb 15, 2022 · 10 comments

Comments

@sunshineRunner22
Copy link

I've copied the following folders from my watch to C:\GARMIN
Activity, Monitor, Settings, Sleep

I run the following command:
C:\Anaconda3\Scripts>python garmindb_cli.py --sleep --copy --import --analyze

44 sleep fit-files are copied from "C:\garmin\sleep" to C:\Users\Admin\HealthData\FitFiles\Monitoring\2022
But the "Processing sleep data"-part of the script seems to be skipped (there is no progress bar).
After the tables are generated the sleep-table in the garmin.db is empty and also in the other databases/tables there is no sleep data.
What am I doing wrong?

@tcgoetz
Copy link
Owner

tcgoetz commented Mar 5, 2022

I haven't tested local copy from watch to DB since I got a Fenix 6 which connects with MTP protocol. It's possible it isn't working anymore. What does the log file say? Test just the import:
garmindb_cli.py --sleep --import
and if that appears to be working, test just the analyze:
garmindb_cli.py --sleep --analyze

@tcgoetz
Copy link
Owner

tcgoetz commented Mar 5, 2022

Actually, I think I see the issue. It's currently only matching JSON sleep files during import. What are the FIT sleep files named? Can you give me some examples?

@tcgoetz
Copy link
Owner

tcgoetz commented Mar 5, 2022

Depending on what the sleep FIt files are named, this might be a work around:
C:\Anaconda3\Scripts>python garmindb_cli.py --sleep --copy
followed by:
C:\Anaconda3\Scripts>python garmindb_cli.py --monitoring --import --analyze
Since I think the sleep FIT files have the same naming pattern as monitoring files and are in the monitoring directory.

@sunshineRunner22
Copy link
Author

Example names of the FIT sleep file are: S1U00000.FIT, S2A00000.FIT, S2E00000.FIT, C1T83425.fit, S2E13300.FIT, etc.
I tried
C:\Anaconda3\Scripts>python garmindb_cli.py --monitoring --import --analyze
and the 44 files were processed (but very fast, as if there wasn't happening anything in the background) and afterwards the tables were generated.
But the sleep-table in the garmin.db is still empty also in the other databases/tables there is no sleep data.
Is it even possible to extract the sleep data directly from the FIT-files (without using Garmin Connect)?

@tcgoetz
Copy link
Owner

tcgoetz commented Mar 6, 2022

Sleep FIT files have the raw sleep levels at a point in time. It's a stream of sleep level and timestamp. From that you can construct the data in the sleep_events table, but the aggregate data in the sleep table will require summarizing the data in the sleep_events table.

tcgoetz pushed a commit that referenced this issue Mar 7, 2022
…auses sleep_events to be populated from FIT files rather than Garmin Connect JSON data
@tcgoetz
Copy link
Owner

tcgoetz commented Mar 7, 2022

Please test the develop branch. see the above new commit. Update and set the new config item "sleep_from_fit" to true then import sleep data and it will import from FIT files rather than Garmin Connect downloads.

tcgoetz pushed a commit that referenced this issue Mar 7, 2022
…eep data from FIT files. Needs no config
@tcgoetz
Copy link
Owner

tcgoetz commented Mar 7, 2022

Latest on develop has a better way to decide between getting sleep data from Garmin Connect and getting sleep data from FIT files. No config needed.

@tcgoetz
Copy link
Owner

tcgoetz commented Mar 7, 2022

After testing this, you should see that your sleep_events table has data. There is additional work needed to generate the data in the sleep table.

@sunshineRunner22
Copy link
Author

Works great, the sleep_events table has data now! Thank you!
Are you planning to generate the data for the sleep table as well in the future?

@tcgoetz
Copy link
Owner

tcgoetz commented Mar 7, 2022

I will aggregate the stats in sleep_events to get per day totals of time in each sleep state at some point. Im not sure where the other data: sleep spo2, sleep rr, and sleep stress comes from right now.

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

No branches or pull requests

2 participants