Skip to content

Conversation

jlaur
Copy link
Contributor

@jlaur jlaur commented May 17, 2025

See https://energidataservice.dk/news:

As part of the transition to 15-minute Market Time Units (MTU), the current dataset Elspot Prices will be discontinued and replaced by a new dataset: Day-Ahead Prices.

Key dates and changes

  • As of 2025-05-08, the Day-Ahead Prices dataset is available on Energi Data Service without data, allowing users to prepare for the upcoming transition.
  • The data delivery in the new dataset will begin on 2025-09-30 where prices for 2025-10-01 will be available.
  • On the same date, the Elspot Prices dataset will be discontinued.

The currently published dataset to prepare for the transition is without data, so cannot be tested.

@jlaur jlaur added work in progress A PR that is not yet ready to be merged enhancement An enhancement or new feature for an existing add-on labels May 17, 2025
@jlaur
Copy link
Contributor Author

jlaur commented May 18, 2025

I have now sent a mail to Energinet to clarify details about the transition and availability of historic prices.

@jlaur jlaur force-pushed the energidataservice-day-ahead-dataset branch from 6c59adc to 26ab44d Compare May 20, 2025 20:12
@jlaur
Copy link
Contributor Author

jlaur commented May 20, 2025

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.

@jlaur jlaur force-pushed the energidataservice-day-ahead-dataset branch 5 times, most recently from 50e5507 to 12f58db Compare May 25, 2025 21:39
@jlaur jlaur removed the work in progress A PR that is not yet ready to be merged label May 27, 2025
@jlaur jlaur marked this pull request as ready for review May 27, 2025 19:28
@jlaur jlaur force-pushed the energidataservice-day-ahead-dataset branch from 12f58db to f4604dd Compare May 27, 2025 20:53
@jlaur jlaur requested a review from a team May 27, 2025 20:58
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur jlaur force-pushed the energidataservice-day-ahead-dataset branch from f4604dd to d19cf52 Compare May 31, 2025 21:53
@jlaur
Copy link
Contributor Author

jlaur commented Jun 28, 2025

@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.

@kaikreuzer kaikreuzer requested a review from Copilot June 28, 2025 16:52
Copy link

@Copilot Copilot AI left a 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;
Copy link

Copilot AI Jun 28, 2025

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.

Copy link
Member

@kaikreuzer kaikreuzer left a 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?

@kaikreuzer kaikreuzer merged commit d909cf8 into openhab:main Jun 28, 2025
2 checks passed
@kaikreuzer kaikreuzer added this to the 5.0 milestone Jun 28, 2025
@jlaur
Copy link
Contributor Author

jlaur commented Jun 29, 2025

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).

@jlaur jlaur deleted the energidataservice-day-ahead-dataset branch June 29, 2025 19:40
@kaikreuzer
Copy link
Member

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. 😄

jlaur added a commit to jlaur/openhab-addons that referenced this pull request Jun 30, 2025
…18695)

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur
Copy link
Contributor Author

jlaur commented Jun 30, 2025

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. 😄

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 src folder comparison between this new branch and the one I've had running in my production system for months, and they are the same.

kaikreuzer pushed a commit that referenced this pull request Jul 1, 2025
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur jlaur added the backported A PR that has been cherry-picked to a patch release branch label Jul 1, 2025
phenix1990 pushed a commit to phenix1990/openhab-addons that referenced this pull request Jul 31, 2025
…18695)

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
psmedley pushed a commit to psmedley/openhab-addons that referenced this pull request Aug 6, 2025
…18695)

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
@openhab-bot
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported A PR that has been cherry-picked to a patch release branch enhancement An enhancement or new feature for an existing add-on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants