yo-han / Home-Assistant-Carelink

Unofficial Home Assistant Carelink Component
MIT License
24 stars 12 forks source link

incorrect timezone setting in nightscout uploader? #66

Closed Trenar closed 8 months ago

Trenar commented 9 months ago

Hello again, I'm currently in a different timezone and note some weird behavior with this integration. The first part of the pipeline works as expected: The SG data is correctly uploaded by my pump, and also correctly downloaded by the HA integration. All timestamps are correctly implemented, independent of the local settings of my computer when checking out the sensors in HA.

However, the second step, uploading to Nightscout, seems to ignore the timestamps. The data is uploaded, but when I checkout my nightscout page, I see it not with respect to the timezone, but as if it was uploaded from my home-timezone, i.e. I see a warning "9 hours ago" (as I'm 9 hours earlier than my home timezone).

I tried understanding the nightscout-uploader.py and noticed that, in principle, the timezones are implemented there, but could not understand where this error is coming from.

Thanks for you time :)

Trenar commented 9 months ago

Addendum:

In the logs, I see a correct recognition of the timezone on downloading the data from carelink:

2024-02-19 17:10:55.321 DEBUG (MainThread) [custom_components.carelink] _async_update_data: {'client_timezone': 'Pacific Standard Time', 'last_update_timestamp': datetime.datetime(2024, 2, 19, 8, 8, tzinfo=zoneinfo.ZoneInfo(key='America/Los_Angeles')), 'last_sg_timestamp': datetime.datetime(2024, 2, 19, 8, 8, tzinfo=zoneinfo.ZoneInfo(key='America/Los_Angeles')), [..sgv & pump data cut..]

The log-timestamp is my server's local time (germany), while the client tz and last_update tz are my current location.

sedy89 commented 9 months ago

I will take a look 👍

github-actions[bot] commented 8 months ago

This issue is stale because it has been open for 30 days with no activity.