Energi Data Service Binding [4.0.0.0;4.1.0.0)

logo

This binding integrates the Danish service Energi Data Service, making data available as:

  • Channels with current prices.
  • An advanced channel with future prices in JSON format.
  • Thing action for importing the prices directly into rules.

In this initial version, electricity prices are in focus, specifically the datasets Elspotprices and DatahubPricelist.

The binding is mainly targeting Denmark because of the tariffs and taxes provided which are specific to the Danish market and in currency DKK. However, spot prices can also be retrieved for other regions, for example Norway and Sweden.

Features

  • Optimized service calls: Spot prices are retrieved once per day and tariffs only upon expiry (usually months/years).
  • Error handing: Policies for retry strategies are in place to make sure data will be retrieved as soon as possible after failed calls. This includes exponential back-off with jitter.
  • Channel configuration for adding VAT to prices based on openHAB regional settings.
  • Grid company is selectable in configuration.
  • Pre-configured filters are included for all known grid companies.
  • Filters can be overridden by channel configuration.
  • Spot prices and all tariffs are supported.
  • Properties shows number of remaining calls as well as timestamp of last/next call.
  • Actions for getting prices and performing calculations.

Changelog

Version 0.1

  • Initial release

Version 0.2

  • Rename all channels
  • Remove VAT channel configuration (please use VAT transformation instead)

Resources

org.openhab.binding.energidataservice-4.0.0-SNAPSHOT.jar

Source code

README

2 Likes

I havnt got the time to test this atm. But I will for sure test this soon, as I have been looking for an easy way to get the spotprice.

Great work, Jacob.

1 Like

I made this post and another post for a 3.4 backport:

Unfortunately both my 3.4.2 production installation and 4.0 test/development installation sees the 3.4 version. I don’t know what I did wrong, but for 4.0 the JAR can be downloaded instead.

@wborn - can you spot what I might have done wrong since the 3.4 version appears in 4.0 as well rather than the version from this post?

The Maven ranges are a bit tricky, 4.0.0) also includes snapshots, that’s why I use 3.5.0) myself with JavaScript Scripting (Nashorn) [3.3.0;3.5.0)

1 Like

Thanks. I have changed it, but can’t test it right now. I’ll report back later how it turned out. :slight_smile:

The 3.4 version now disappeared from the list on a 4.0 system. But the 4.0 version doesn’t show either.

@rlkoshak - do you have an idea what could be the problem here, or maybe you know someone…? :slightly_smiling_face:

I’ve been using [4.0.0,) for my 4.x version rule templates. What you have here seems like it should work but :person_shrugging: , I’m not Maven expert.

The comment by @wborn might be telling. Maybe my approach includes the snapshots but your version would only include snapshots for 4.1.0 and above.

1 Like

That fixed it, thanks!

That won’t be considered as a valid range because it uses , instead of ; so it will show on any OH version.

I did some more testing and found that [4.0.0;) is not a valid range either.

It does consider micro versions as well, so what seems to work better is [4.0.0.0;4.1.0.0)
That allows for any snapshot/milestone build (and excludes 4.1.0 snapshots) but it becomes trickier to come up with a range whenever compatibility is lost after a certain date, milestone. :upside_down_face:

You can experiment with this like in the BundleVersionTest by adding a test like:

@Test
public void rangeTest() {
    String range = "[4.0.0.0;4.1.0.0)";
    
    assertThat(new BundleVersion("4.0.0").inRange(range), is(true));
    assertThat(new BundleVersion("4.0.0.M1").inRange(range), is(true));
    assertThat(new BundleVersion("4.0.0.RC1").inRange(range), is(true));
    assertThat(new BundleVersion("4.0.0.202201311711").inRange(range), is(true));
    
    assertThat(new BundleVersion("4.1.0").inRange(range), is(false));
    assertThat(new BundleVersion("4.1.0.M1").inRange(range), is(false));
    assertThat(new BundleVersion("4.1.0.RC1").inRange(range), is(false));
    assertThat(new BundleVersion("4.1.0.202307311711").inRange(range), is(false));
}
2 Likes