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

Timezone issues #100

Open
HockeyTrafalgar opened this issue Oct 1, 2024 · 5 comments
Open

Timezone issues #100

HockeyTrafalgar opened this issue Oct 1, 2024 · 5 comments

Comments

@HockeyTrafalgar
Copy link

Hi! Thanks for migrating to Source in such a timely fashion!)

After updating to the latest revision from Github (commit ID d9d1b8a), it looks like times of entries got messed up. Regardless of the TIMEZONE_NAME setting in .env, all events are written to Nightscout as correct time+4 hours (my TIMEZONE_NAME='Asia/Dubai', which is GMT+4). Tried changing to TIMEZONE_NAME='America/New_York' or TIMEZONE_NAME='America/Los_Angeles', does not make a difference - all events are still written with time +4 hours.

@jwoglom
Copy link
Owner

jwoglom commented Oct 1, 2024

Thanks for catching this. I will put up a fix later today.

@jwoglom jwoglom closed this as completed in 4af54bf Oct 1, 2024
@HockeyTrafalgar
Copy link
Author

Thank you for looking this one!

Unfortunately, the problem did not go away. Not sure if Nightscout is acting correctly in this case.

For example, this is bolus event written by tconnectsync. 6am here is my actual local time when the bolus was delivered, and utcOffset was added:

Nightscout> db.treatments.find({eventType:"Combo Bolus"}).sort({created_at:-1}).limit(5)
[
  {
    _id: ObjectId('66fcdb2f21c5535ee85a91b7'),
    eventType: 'Combo Bolus',
    created_at: '2024-10-02T06:16:47.000Z',
    carbs: 85,
    insulin: 11,
    notes: 'Standard Bolus (Override)',
    enteredBy: 'Pump (tconnectsync)',
    pump_event_id: '1687385,1687355,1687356,1687357',
    glucose: 124,
    utcOffset: 240
  },

But when I manually add events to Nightscout, it looks like this. In this case created_at is UTC time, corresponding to 9:38 my local time.

Nightscout> db.treatments.find({eventType:"Bolus"}).sort({created_at:-1}).limit(5)
[
  {
    _id: ObjectId('66fcdc7b21c5535ee85a92c8'),
    enteredBy: 'xDrip4iOS',
    eventType: 'Bolus',
    insulin: 0.11,
    created_at: '2024-10-02T05:38:55.639Z',
    utcOffset: 0
  }
]

Also it's worth mentioning everything worked before the update. Hope this will help!

Another this, after pulling the latest code got the following message:

2024-10-02 08:45:50 INFO Processed 8 events. Last event ID seen: 1687579
Traceback (most recent call last):
File "main.py", line 5, in
main()
File "/home/ubuntu/tconnectsync/tconnectsync/init.py", line 127, in main
sys.exit(0 if added>0 else 1)
TypeError: '>' not supported between instances of 'tuple' and 'int'

(this line)
sys.exit(0 if added>0 else 1)

@jwoglom
Copy link
Owner

jwoglom commented Oct 2, 2024

@HockeyTrafalgar Okay I think I have it translating the timezones correctly now. I was translating the time which was in the pump's local timezone from UTC to the equivalent time in that timezone (which then caused the off-by-UTC-offset) instead of replacing the timezone offset on that timezone to be that of the local timezone so that Nightscout was aware of the timezone. Please take a look at v2.1.0 and let me know if it fixes it (It resolved the issue on my local instance with America/New_York TZ)

@jwoglom jwoglom reopened this Oct 2, 2024
@HockeyTrafalgar
Copy link
Author

Perfect, timezones work!

Just little message is still there:

File "/home/ubuntu/tconnectsync/tconnectsync/init.py", line 127, in main
sys.exit(0 if added>0 else 1)
TypeError: '>' not supported between instances of 'tuple' and 'int'

Please allow me to take this moment to tell you how much your app helps our family to monitor our daughter's diabetes while she's in school. She's 8 and she started to operate the pump by herself this year, so it's absolutely necessary to see in realtime what's up with automatic delivery and if there are any mistakes in manual boluses. Thank you so much.

@jwoglom
Copy link
Owner

jwoglom commented Oct 5, 2024

The error should be gone now -- although it shouldn't have actually affected the operation of tconnectsync since it was an error in how i was handling the return exit code at the very end of the app. Thanks for reporting the issue and glad that it helps!

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