Code Monkey home page Code Monkey logo

Comments (17)

stratus-ss avatar stratus-ss commented on August 23, 2024 1

@esmoyer
Ok I pushed an update, you'll have to set
gather_hrv_data = True

Because not everyone has this data. If it was on by default it would throw errors when trying to insert None into influx

from garmin-influxdb.

stratus-ss avatar stratus-ss commented on August 23, 2024 1

added your current_date line. Please close this if you are satisfied

from garmin-influxdb.

esmoyer avatar esmoyer commented on August 23, 2024 1

Much appreciated!

from garmin-influxdb.

stratus-ss avatar stratus-ss commented on August 23, 2024

the only reason why items may be missing is largely due to the fact that I personally didn't want to track that metric long term at the time I started this script.

I haven't specifically looked into it, but I don't know if there is a technical reason it wouldn't work

from garmin-influxdb.

stratus-ss avatar stratus-ss commented on August 23, 2024

out of curiosity which heart rate stuff are you looking for? In the main script there is some heart-rate stuff that is commented out because I personally don't capture that. Maybe you can share a screen shot from the garmin website so I know exactly which thing you are interested in

from garmin-influxdb.

esmoyer avatar esmoyer commented on August 23, 2024

I just got a Venu 3 and was looking to do heart rate variability (HRV). I see the garmin-pythonconnect has it (option x in their example.py); just need to figure out how to translate that over.

from garmin-influxdb.

stratus-ss avatar stratus-ss commented on August 23, 2024

got it, I'm testing, will probably have a push today

from garmin-influxdb.

stratus-ss avatar stratus-ss commented on August 23, 2024

I tried the example.py but it doesn't produce any results. I am not sure if this is broken or whether I just don't have this data available. I have implemented the same functionality but because I am getting NONE from my account, i cant be sure it works

from garmin-influxdb.

stratus-ss avatar stratus-ss commented on August 23, 2024

@esmoyer can you run the upstream example.py and post the json it should print out? I can't format the influx data without that json

from garmin-influxdb.

esmoyer avatar esmoyer commented on August 23, 2024

Absolutely!

DEBUG:garminconnect:Requesting Heart Rate Variability (hrv) data
DEBUG:urllib3.connectionpool:https://connectapi.garmin.com:443 "GET /hrv-service/hrv/2024-02-17 HTTP/1.1" 200 None
-------------------- api.get_hrv_data(2024-02-17) --------------------
{
    "userProfilePk": 108183007,
    "hrvSummary": {
        "calendarDate": "2024-02-17",
        "weeklyAvg": 22,
        "lastNightAvg": 21,
        "lastNight5MinHigh": 25,
        "baseline": null,
        "status": "POOR",
        "feedbackPhrase": "HRV_POOR_3",
        "createTimeStamp": "2024-02-17T10:42:48.667"
    },
    "hrvReadings": [
        {
            "hrvValue": 14,
            "readingTimeGMT": "2024-02-17T03:53:25.0",
            "readingTimeLocal": "2024-02-16T21:53:25.0"
        },
        {
            "hrvValue": 15,
            "readingTimeGMT": "2024-02-17T03:58:25.0",
            "readingTimeLocal": "2024-02-16T21:58:25.0"
        },
        {
            "hrvValue": 19,
            "readingTimeGMT": "2024-02-17T04:03:25.0",
            "readingTimeLocal": "2024-02-16T22:03:25.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T04:08:25.0",
            "readingTimeLocal": "2024-02-16T22:08:25.0"
        },
        {
            "hrvValue": 12,
            "readingTimeGMT": "2024-02-17T04:13:25.0",
            "readingTimeLocal": "2024-02-16T22:13:25.0"
        },
        {
            "hrvValue": 13,
            "readingTimeGMT": "2024-02-17T04:18:25.0",
            "readingTimeLocal": "2024-02-16T22:18:25.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T04:23:25.0",
            "readingTimeLocal": "2024-02-16T22:23:25.0"
        },
        {
            "hrvValue": 18,
            "readingTimeGMT": "2024-02-17T04:28:25.0",
            "readingTimeLocal": "2024-02-16T22:28:25.0"
        },
        {
            "hrvValue": 15,
            "readingTimeGMT": "2024-02-17T04:33:25.0",
            "readingTimeLocal": "2024-02-16T22:33:25.0"
        },
        {
            "hrvValue": 14,
            "readingTimeGMT": "2024-02-17T04:38:25.0",
            "readingTimeLocal": "2024-02-16T22:38:25.0"
        },
        {
            "hrvValue": 15,
            "readingTimeGMT": "2024-02-17T04:43:25.0",
            "readingTimeLocal": "2024-02-16T22:43:25.0"
        },
        {
            "hrvValue": 13,
            "readingTimeGMT": "2024-02-17T04:48:25.0",
            "readingTimeLocal": "2024-02-16T22:48:25.0"
        },
        {
            "hrvValue": 13,
            "readingTimeGMT": "2024-02-17T04:53:25.0",
            "readingTimeLocal": "2024-02-16T22:53:25.0"
        },
        {
            "hrvValue": 12,
            "readingTimeGMT": "2024-02-17T04:58:25.0",
            "readingTimeLocal": "2024-02-16T22:58:25.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T05:03:25.0",
            "readingTimeLocal": "2024-02-16T23:03:25.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T05:08:25.0",
            "readingTimeLocal": "2024-02-16T23:08:25.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T05:13:25.0",
            "readingTimeLocal": "2024-02-16T23:13:25.0"
        },
        {
            "hrvValue": 14,
            "readingTimeGMT": "2024-02-17T05:18:25.0",
            "readingTimeLocal": "2024-02-16T23:18:25.0"
        },
        {
            "hrvValue": 15,
            "readingTimeGMT": "2024-02-17T05:23:25.0",
            "readingTimeLocal": "2024-02-16T23:23:25.0"
        },
        {
            "hrvValue": 13,
            "readingTimeGMT": "2024-02-17T05:28:25.0",
            "readingTimeLocal": "2024-02-16T23:28:25.0"
        },
        {
            "hrvValue": 19,
            "readingTimeGMT": "2024-02-17T05:33:25.0",
            "readingTimeLocal": "2024-02-16T23:33:25.0"
        },
        {
            "hrvValue": 15,
            "readingTimeGMT": "2024-02-17T05:38:25.0",
            "readingTimeLocal": "2024-02-16T23:38:25.0"
        },
        {
            "hrvValue": 13,
            "readingTimeGMT": "2024-02-17T05:43:25.0",
            "readingTimeLocal": "2024-02-16T23:43:25.0"
        },
        {
            "hrvValue": 15,
            "readingTimeGMT": "2024-02-17T05:48:25.0",
            "readingTimeLocal": "2024-02-16T23:48:25.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T05:53:25.0",
            "readingTimeLocal": "2024-02-16T23:53:25.0"
        },
        {
            "hrvValue": 15,
            "readingTimeGMT": "2024-02-17T05:58:25.0",
            "readingTimeLocal": "2024-02-16T23:58:25.0"
        },
        {
            "hrvValue": 25,
            "readingTimeGMT": "2024-02-17T06:03:25.0",
            "readingTimeLocal": "2024-02-17T00:03:25.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T06:08:25.0",
            "readingTimeLocal": "2024-02-17T00:08:25.0"
        },
        {
            "hrvValue": 18,
            "readingTimeGMT": "2024-02-17T06:13:25.0",
            "readingTimeLocal": "2024-02-17T00:13:25.0"
        },
        {
            "hrvValue": 19,
            "readingTimeGMT": "2024-02-17T06:18:25.0",
            "readingTimeLocal": "2024-02-17T00:18:25.0"
        },
        {
            "hrvValue": 22,
            "readingTimeGMT": "2024-02-17T06:23:25.0",
            "readingTimeLocal": "2024-02-17T00:23:25.0"
        },
        {
            "hrvValue": 20,
            "readingTimeGMT": "2024-02-17T06:28:25.0",
            "readingTimeLocal": "2024-02-17T00:28:25.0"
        },
        {
            "hrvValue": 19,
            "readingTimeGMT": "2024-02-17T06:33:25.0",
            "readingTimeLocal": "2024-02-17T00:33:25.0"
        },
        {
            "hrvValue": 18,
            "readingTimeGMT": "2024-02-17T06:38:25.0",
            "readingTimeLocal": "2024-02-17T00:38:25.0"
        },
        {
            "hrvValue": 17,
            "readingTimeGMT": "2024-02-17T06:43:22.0",
            "readingTimeLocal": "2024-02-17T00:43:22.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T06:48:22.0",
            "readingTimeLocal": "2024-02-17T00:48:22.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T06:53:22.0",
            "readingTimeLocal": "2024-02-17T00:53:22.0"
        },
        {
            "hrvValue": 15,
            "readingTimeGMT": "2024-02-17T06:58:22.0",
            "readingTimeLocal": "2024-02-17T00:58:22.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T07:03:22.0",
            "readingTimeLocal": "2024-02-17T01:03:22.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T07:08:22.0",
            "readingTimeLocal": "2024-02-17T01:08:22.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T07:13:22.0",
            "readingTimeLocal": "2024-02-17T01:13:22.0"
        },
        {
            "hrvValue": 15,
            "readingTimeGMT": "2024-02-17T07:18:22.0",
            "readingTimeLocal": "2024-02-17T01:18:22.0"
        },
        {
            "hrvValue": 14,
            "readingTimeGMT": "2024-02-17T07:23:22.0",
            "readingTimeLocal": "2024-02-17T01:23:22.0"
        },
        {
            "hrvValue": 15,
            "readingTimeGMT": "2024-02-17T07:28:22.0",
            "readingTimeLocal": "2024-02-17T01:28:22.0"
        },
        {
            "hrvValue": 17,
            "readingTimeGMT": "2024-02-17T07:33:22.0",
            "readingTimeLocal": "2024-02-17T01:33:22.0"
        },
        {
            "hrvValue": 19,
            "readingTimeGMT": "2024-02-17T07:38:22.0",
            "readingTimeLocal": "2024-02-17T01:38:22.0"
        },
        {
            "hrvValue": 17,
            "readingTimeGMT": "2024-02-17T07:43:22.0",
            "readingTimeLocal": "2024-02-17T01:43:22.0"
        },
        {
            "hrvValue": 13,
            "readingTimeGMT": "2024-02-17T07:48:22.0",
            "readingTimeLocal": "2024-02-17T01:48:22.0"
        },
        {
            "hrvValue": 16,
            "readingTimeGMT": "2024-02-17T07:53:22.0",
            "readingTimeLocal": "2024-02-17T01:53:22.0"
        }
    ],
    "startTimestampGMT": "2024-02-17T03:50:00.0",
    "endTimestampGMT": "2024-02-17T07:53:22.0",
    "startTimestampLocal": "2024-02-16T21:50:00.0",
    "endTimestampLocal": "2024-02-17T01:53:22.0",
    "sleepStartTimestampGMT": "2024-02-17T03:50:00.0",
    "sleepEndTimestampGMT": "2024-02-17T07:56:00.0",
    "sleepStartTimestampLocal": "2024-02-16T21:50:00.0",
    "sleepEndTimestampLocal": "2024-02-17T01:56:00.0"
}

from garmin-influxdb.

stratus-ss avatar stratus-ss commented on August 23, 2024

of this data what is actually important to track? the summary? the real values?

from garmin-influxdb.

esmoyer avatar esmoyer commented on August 23, 2024

I would say the readings and

"weeklyAvg": 22,
"lastNightAvg": 21,
"status": "POOR",

but would take whatever is easiest...

from garmin-influxdb.

stratus-ss avatar stratus-ss commented on August 23, 2024

i'll have to think about how to handle the readings. Right now the stats are going in with a single timestamp into influx because they are single metrics. This is a multi-point metric which means a series of entries which is deviating from the other metrics inserted up to this point

from garmin-influxdb.

esmoyer avatar esmoyer commented on August 23, 2024

Makes sense, if it's easier, then I'd be happy with just the 3 stats.

from garmin-influxdb.

stratus-ss avatar stratus-ss commented on August 23, 2024

its significantly easier as a short term fix. I can probably push that type of fix in the next hour, though I have no real way to test it as I don't have this metric on my account.

I am open to trying to get the hrvValue in as well, it may just take longer

from garmin-influxdb.

esmoyer avatar esmoyer commented on August 23, 2024

Appreciate anything you have. I can certainly test things out.

from garmin-influxdb.

esmoyer avatar esmoyer commented on August 23, 2024

That worked! I did have to add "current_date": time.strftime(influxdb_time_format, time.localtime(daily_stats_date))

So this is what ended up working! Appreciate the quick work!

if gather_hrv_data:
    # Only gather this data if the user has set this to true
    # This data isn't available on all devices so it will error if set to True by default
    client_get_hrv = f'client.get_hrv_data("{day}")'
    hrv_data = get_data_from_garmin("hrv_data", client_get_hrv, client=client)
    hrv_daily_summary = {
        "hrv_last_night_avg": hrv_data['hrvSummary']['lastNightAvg'],
        "hrv_weekly_avg": hrv_data['hrvSummary']['weeklyAvg'],
        "hrv_status": hrv_data['hrvSummary']['status'],
        "current_date": time.strftime(influxdb_time_format, time.localtime(daily_stats_date)) 
    }
    create_influxdb_daily_measurement(hrv_daily_summary, influxdb_client)

from garmin-influxdb.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.