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

Values fetched from CareLink are in the wrong timezone (UTC) #30

Open
sirKitKat opened this issue Jan 19, 2022 · 15 comments
Open

Values fetched from CareLink are in the wrong timezone (UTC) #30

sirKitKat opened this issue Jan 19, 2022 · 15 comments

Comments

@sirKitKat
Copy link

sirKitKat commented Jan 19, 2022

After switching from dexcom to medtronic (780G + Guardian 4), the values displayed are shifted by one hour:
image

If I look at the data in mongodb, I suspect that mmconnect wrongly stores the timestamp:
image
image

More Information about my setup:
I'm running a NAS with unRaid 6.9.2 (timezone: UTC+1 Europe/Brussels)
Included in unraid is Docker version 20.10.5
running docker mongodb version
running docker nightscout version 14.2.5

@sirKitKat
Copy link
Author

If I use the "carelink_raw" profile to fetch data, I can see in the returned data that all sgv are timestampt with an UTC time notation but with the local time:

  {
    "_id": { "$oid": "<redacted>" },
    "date": 1642635272690,
    "dateString": "2022-01-19T23:34:32.690Z",
    "type": "carelink_raw",
    "data": {
      "lastSensorTS": 0,
      "medicalDeviceTimeAsString": "2022-01-20T00:33:49.758-00:00",
      "lastSensorTSAsString": "2022-01-20T00:29:00.000Z",
...
      "sgs": [
        {
          "sg": 164,
          "datetime": "2022-01-20T00:04:00.000Z",
          "timeChange": false,
          "sensorState": "NO_ERROR_MESSAGE",
          "kind": "SG",
          "version": 1,
          "relativeOffset": -1790
        },
        {
          "sg": 162,
          "datetime": "2022-01-20T00:09:00.000Z",
          "timeChange": false,
          "sensorState": "NO_ERROR_MESSAGE",
          "kind": "SG",
          "version": 1,
          "relativeOffset": -1490
        },
...
        {
          "sg": 159,
          "datetime": "2022-01-20T00:29:00.000Z",
          "timeChange": false,
          "sensorState": "NO_ERROR_MESSAGE",
          "kind": "SG",
          "version": 1,
          "relativeOffset": -290
        }
      ],
...
    },
    "utcOffset": 0,
    "sysTime": "2022-01-19T23:34:32.690Z"
  },

@sirKitKat
Copy link
Author

sirKitKat commented Jan 20, 2022

Things I tried so far:

  • changing the timezone of my unraid setup to UTC (no effect)
  • restarting the docker service (no effect)
  • changing the timezone of the nightscout docker to UTC (with the -e TZ=UTC variable) (no effect)
    Also I found this in the logs after the last change:
2022-01-20T07:15:19.893Z [Arguments] {
'0': 'Guessed pump timezone -NaN00 (pump time: "2022-01-20T08:13:52.598-00:00"; server time: Thu Jan 20 2022 07:15:19 GMT+0000 (Coordinated Universal Time))'
}

Can I conclude that the function guessPumpOffset() in transform.js has a bug that results in Not a number?

  • changing back the time of my unraid server to Europe/Brussels (no effect)
  • removed the variable TZ from the nightscout docker (no effect)
2022-01-20T08:35:56.738Z [Arguments] {
'0': 'Guessed pump timezone -NaN00 (pump time: "2022-01-20T09:33:51.337-00:00"; server time: Thu Jan 20 2022 09:35:56 GMT+0100 (Central European Standard Time))'
}

@sirKitKat
Copy link
Author

Hmm, I fixed the bug in the function guessPumpOffset but it doesn't seem to have an effect on the reported values -_-

@sirKitKat
Copy link
Author

In the end, I've rewritten transform.js and manually subtract the calculated timezone from the pump time to correct the values.

@mgre3
Copy link

mgre3 commented Jan 29, 2022

Nice. How did you manage to get data from the 780G in Europe? For me it is still not possible.

@sirKitKat
Copy link
Author

Nice. How did you manage to get data from the 780G in Europe? For me it is still not possible.

By providing the following parameters to the docker container running nightscout:
https://github.com/nightscout/cgm-remote-monitor#mmconnect-minimed-connect-bridge
I've used my credentials from carelink connect.

@mgre3
Copy link

mgre3 commented Feb 1, 2022

Nice. How did you manage to get data from the 780G in Europe? For me it is still not possible.

By providing the following parameters to the docker container running nightscout: https://github.com/nightscout/cgm-remote-monitor#mmconnect-minimed-connect-bridge I've used my credentials from carelink connect.

Thanks, now I have my Nightscout also filled with data again.

Can you share the version of transform.js you are using right now? Which changes did you apply? Because I am having the same issue right now with the timezone.

@sirKitKat
Copy link
Author

Here you go, it's not ideal but I hope you can use it:
transform.js.txt

(PS: Beware that, if you are using the docker image, you'll need to link this file from outside the docker container or the file will be overwritten when the docker is updated/started/...)

@mstietencron
Copy link

Here you go, it's not ideal but I hope you can use it: transform.js.txt

Thanks a lot. This works well for me! :)

@Jornvanbeek
Copy link

Hi! I have the same problem as you guys with the shifted time, so I think the changed transform file should also help me. Though I do need some help, as I am not used to working in JavaScript.
I forked the cgm-remote-monitor in github, and deployed using railway and mongoDB. I have forked the minimed-connect-to-nightscout repo, and changed the transform.js file. Now I am unsure how to change the cgm-remote-monitor to use my forked repo of the mmconnect plugin. Do you have an idea how to do this, or an alternative solution? Hope you can help!

@nfontan
Copy link

nfontan commented Oct 24, 2022

Hi! I have the same problem as you guys with the shifted time, so I think the changed transform file should also help me. Though I do need some help, as I am not used to working in JavaScript. I forked the cgm-remote-monitor in github, and deployed using railway and mongoDB. I have forked the minimed-connect-to-nightscout repo, and changed the transform.js file. Now I am unsure how to change the cgm-remote-monitor to use my forked repo of the mmconnect plugin. Do you have an idea how to do this, or an alternative solution? Hope you can help!

Hi, I was in the same situation as you.
What you have to do is modify the nightscout package.json and point it to your repository where the code will be with the new transform.js

Look my package.json
https://github.com/nfontan/cgm-remote-monitor/blob/master/package.json

line 111

@bewest
Copy link
Member

bewest commented Nov 18, 2022

@sirKitKat do you have a pull request available for this?

bewest added a commit that referenced this issue Nov 18, 2022
@sirKitKat volunteers these changes in issue #30.
@sirKitKat
Copy link
Author

@sirKitKat do you have a pull request available for this?

I have no idea how to do that, so feel free to use my code for improvements 👍

@nfontan
Copy link

nfontan commented Dec 6, 2022

@sirKitKat
Hi
I am helping someone from Europe/Budapest to set this up and we are having a problem. In the debug we get the error that I attached to the screenshot.
We have tried with the original transform.js and the modified one but we get the same result. Do you have any idea what it could be? In carelink we see the data well

thanks!
image

bewest added a commit that referenced this issue Jan 6, 2023
@polarfish
Copy link

I have the same issue for 780G.
Local time - UTC+2
Pump time - UTC+2
I tried the latest tag (version 14.2.6) and the latest_dev tag (version 15.0.0) and both show me:

2023-05-19T21:09:46.413Z [Arguments] {
  '0': 'Guessed pump timezone -NaN00 (pump time: "2023-05-19T23:06:36.216-00:00"; server time: Fri May 19 2023 21:09:46 GMT+0000 (Coordinated Universal Time))'
}

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

7 participants