-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[energidataservice] Add support for day-ahead dataset with 15-minute resolution #18695
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
[energidataservice] Add support for day-ahead dataset with 15-minute resolution #18695
Conversation
I have now sent a mail to Energinet to clarify details about the transition and availability of historic prices. |
6c59adc
to
26ab44d
Compare
I have received confirmation that the discontinuation of the old dataset only means it will no longer be updated, but it will still be available for historical prices. Moreover, the transition has been postponed from 2024-06-11 to 2024-09-30. So the PR is already in a good state, since my assumptions were confirmed. I have updated the cutover date in the code. This means that the preparations can make it into 5.0 before the transition will take place, so there will be no need for alternative distribution of the binding, at least for the current openHAB version. I'm considering some kind of manual override just in case the date will once again change. Otherwise the binding is programmed to stop working on the date of the planned transition, if in fact the transition won't happen exactly on that date. |
50e5507
to
12f58db
Compare
12f58db
to
f4604dd
Compare
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
f4604dd
to
d19cf52
Compare
@openhab/add-ons-maintainers - I hope someone will have time to review this before the release. Otherwise the binding will stop working on October 1st 2025. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for a new day‐ahead dataset with 15‑minute resolution while maintaining compatibility with the existing elspot dataset until the transition date. Key changes include updating cache mechanisms and provider logic to handle both datasets, adding new tests for various timing scenarios, and extending configuration options via properties and addon XML.
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
SpotPriceSubscriptionCacheTest.java | Added new tests to verify cache behavior with varying time resolutions and transition scenarios. |
ElectricityPriceProviderTest.java | Updated tests to verify correct API method calls depending on transition timing. |
OH-INF/*.properties, addon.xml, README.md | Extended configuration to support a dynamic day‐ahead transition date. |
Cache and Provider classes (.java) | Refactored constructors, updated record types, and adjusted logic to select between elspot and day‐ahead datasets based on the transition date. |
ApiController.java | Added methods to retrieve day‐ahead price data and handle JSON deserialization for the new dataset. |
DTOs (.java) | Introduced new SpotPriceRecord interface and DayAheadPriceRecord DTO along with related records. |
Comments suppressed due to low confidence (2)
bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/provider/ElectricityPriceProvider.java:467
- Consider adding more detailed inline documentation for the next update calculation logic, explaining why Instant.EPOCH is used as the reference point for computing the next update time.
Instant now = Instant.now();
bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/handler/EnergiDataServiceHandler.java:450
- Consider clarifying the boundary condition logic by documenting the rationale for using dayAheadFirstDate (derived from the transition date plus one day) to split the queries between SpotPrices and DayAheadPrices.
if (startDate.isBefore(dayAheadFirstDate)) {
return Instant.now() | ||
.isBefore(dayAheadTransitionDate.atTime(DAILY_REFRESH_TIME_CET).atZone(NORD_POOL_TIMEZONE).toInstant()) | ||
? Dataset.SpotPrices | ||
: Dataset.DayAheadPrices; |
Copilot
AI
Jun 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For improved testability, consider injecting a Clock dependency instead of calling Instant.now() directly in getDayAheadDataset().
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that's an important update indeed!
Since we will further support 4.3.x until at least end of the year, I guess we should backport this as well, right?
Thanks for the review! That's a good point, since probably not everyone will upgrade to 5.0 before October. In order to backport this, #18379, #18583 and #18644 should be backported as well. I have been running a 4.3 version with all 5.0 changes included on my production system for a long time, so it should be okay to do so. I can try to cherry-pick them and see if they will fit right in? If done in the right order, at most there can be a conflict with adjacent imports (see #18589). |
Yes, if you could try the cherry-picking, it would be ideal as you know best how the code should look like in the end. 😄 |
…18695) Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Unfortunately I ran into the same conflict as feared, so to keep it safe and transparent, I have created #18876 which cherry-picks the four commits and resolves the conflict. Additionally I have made a full |
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
…18695) Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
…18695) Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Paul Smedley <paul@smedley.id.au>
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/energi-data-service-binding-4-0-0-0-4-1-0-0/144370/69 |
See https://energidataservice.dk/news:
The currently published dataset to prepare for the transition is without data, so cannot be tested.