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

Daylight Saving Time issue #7

Closed
Hapattaja opened this issue Mar 22, 2023 · 3 comments
Closed

Daylight Saving Time issue #7

Hapattaja opened this issue Mar 22, 2023 · 3 comments

Comments

@Hapattaja
Copy link

Hapattaja commented Mar 22, 2023

Actually this is a bug in Caruna Plus API itself. It doesn't handle timestamps correctly when daylight saving offset is changing.

Please correct me if I have misunderstood something.

API returns all hours within a day. Results are returned as local times with time zone offset, so the first hour is 00:00 local time and the last hour is 23:00 local time.

When the daylight saving offset is increased (March), there should be returned only 23 hours instead of 24.
And when the daylight saving offset is decreased (October), there should be 25 hours, one extra hour.

However:

UTC                        = Europe/Helsinki            Data from API
03/25/2017 22:00:00 +00:00 = 03/26/2017 00:00:00 +02:00 { "timestamp":"2017-03-26T00:00:00+02:00", "totalConsumption":0.9, ... },
03/25/2017 23:00:00 +00:00 = 03/26/2017 01:00:00 +02:00 { "timestamp":"2017-03-26T01:00:00+02:00", "totalConsumption":1.01, ... },
03/26/2017 00:00:00 +00:00 = 03/26/2017 02:00:00 +02:00 { "timestamp":"2017-03-26T02:00:00+02:00", "totalConsumption":1.09, ... },
                                  ** DUPLICATED ITEM ** { "timestamp":"2017-03-26T02:00:00+02:00", "totalConsumption":1.09, ... },
03/26/2017 01:00:00 +00:00 = 03/26/2017 04:00:00 +03:00 { "timestamp":"2017-03-26T04:00:00+03:00", "totalConsumption":0.91, ... },
03/26/2017 02:00:00 +00:00 = 03/26/2017 05:00:00 +03:00 { "timestamp":"2017-03-26T05:00:00+03:00", "totalConsumption":0.94, ... },

The above can be corrected, we could skip the duplicated hour.

UTC                        = Europe/Helsinki             Data from API
10/28/2017 21:00:00 +00:00 = 10/29/2017 00:00:00 +03:00  { "timestamp":"2017-10-29T00:00:00+03:00", "totalConsumption":0.33, ... },
10/28/2017 22:00:00 +00:00 = 10/29/2017 01:00:00 +03:00  { "timestamp":"2017-10-29T01:00:00+03:00", "totalConsumption":0.8, ... },
10/28/2017 23:00:00 +00:00 = 10/29/2017 02:00:00 +03:00  { "timestamp":"2017-10-29T02:00:00+03:00", "totalConsumption": 0.35, ... },
10/29/2017 00:00:00 +00:00 = 10/29/2017 03:00:00 +03:00  { "timestamp":"2017-10-29T03:00:00+03:00" }, ** MISSING DATA **
10/29/2017 01:00:00 +00:00 = 10/29/2017 03:00:00 +02:00  ** MISSING ITEM **
10/29/2017 02:00:00 +00:00 = 10/29/2017 04:00:00 +02:00  { "timestamp":"2017-10-29T04:00:00+02:00", totalConsumption: 0.34, ... },
10/29/2017 03:00:00 +00:00 = 10/29/2017 05:00:00 +02:00  { "timestamp":"2017-10-29T05:00:00+02:00", totalConsumption: 0.42, ... },

However this is an issue, because two hours of data is missing.


I noticed that Excel reports are working correctly, but in reports values are rounded. I also compared the data retrieved from the old "Energiaseuranta".

Note: I'm not actually using this code, I use my own version written in C#.

@Jalle19
Copy link
Owner

Jalle19 commented May 17, 2023

I didn't notice this issue until now, sorry about that. Do you have a proposed solution for this? Perhaps we could just mention it in the README under a "caveats" section if like you say it's basically a bug in the API itself?

@Hapattaja
Copy link
Author

Hapattaja commented May 17, 2023

I have reported the bug to Caruna, but they have not responded and the issue still exists.
Because this is a bug in Caruna's web application, I think we just have to wait for a fix.

I agree with your proposal.

@Jalle19
Copy link
Owner

Jalle19 commented May 22, 2023

Added a note to the README. Thanks for reporting this!

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