Energi Data Service Binding [4.0.0.0;4.1.0.0)

Hi Jacob,

Thanks a lot for a nice binding! Very useful!

Not fully related question to the binding itself - but I have noticed that energydataservice does not update it’s prediction prices at +/-13:00 anymore. Since probably two days ago. I see in the binding logs that today’s stats arrived just after midnight - not yesterday at noon. Do you know if Energi Data Service doing some changes on the policy ? it’s more difficult to predict for next day when next day data comes actually at the beginning of the next day :slight_smile:

See Bringing electricity information from eloverblik.dk and energidataservice.dk into Openhab - #131 by laursen

Huh. Have been browsing their website since yesterday :slight_smile: They just have published that last news - i should have more patience. Thanks for prompt reply!!

I have to admit that I also checked their site for status yesterday without finding any news, so it seems their update was quite late indeed. But it was pretty clear they were having issues. When browsing the dataset, there were no day-ahead prices for any price area.

Yeap - I also checked Dataset and even API - data was ending on the last hour of day - no next day data. Somehow did not find anything anywhere on Danish websites - so wrote here hoping you know more :slight_smile: But okey - hopefully they fix it soon.

Hi Jacob,

Thanks a lot for a nice binding!

I think I got it set up acordingly to the documentation, defined items are being updated as expected.

However using the Thing Actions teases me a bit.

For charging my PHEV, depending on the energy price and how low the battery state is, I would like to find the best X hours for charging. I expect to use the " calculateCheapestPeriod from Duration" Thing Action for that purpose. And that’s where I get a bit stuck.

Do I miunderstand the documentation, or miss something, when I expect to achive it by putting something like this in a rules file?

val actions = getActions("energidataservice", "energidataservice:service:energidataservice")
var Map<String, Object> result = actions.calculateCheapestPeriod(now.toInstant(), now.plusHours(12).toInstant(), Duration.ofMinutes(90))


rule "TestEnergiBeregning"
when
	Item TestVenstre changed  from OFF to ON
then
	executeCommandLine(actions); Thread::sleep(5000)
end

Best regards Ole

Two things

  1. getActions needs YOUR_THING_UID. Copy the uid when from the thing list in UI.
    image
  2. The lines on top of your example needs to be inside of the rule

In addition if you want a price you need to add power value. Shown in powerResult below

import java.util.Map;

rule "TestEnergiBeregning"
when
	Item TestVenstre changed  from OFF to ON
then
    val actions = getActions("energidataservice", "YOUR_THING_UID")
    // log output shall be something like org.openhab.binding.energidataservice.internal.action.EnergiDataServiceActions@xyz - not null!
    logInfo("TestEnergiBeregning", actions.toString)
    var Map<String, Object> durationResult = actions.calculateCheapestPeriod(now.toInstant(), now.plusHours(12).toInstant(), Duration.ofMinutes(90))    
    // log output will show Map with keys and values as String
    logInfo("TestEnergiBeregning", durationResult.toString)
    // if your wallbox is charging with 11kW you can use the following line to get the cheapest period for this power value
    var Map<String, Object> powerResult = actions.calculateCheapestPeriod(now.toInstant(), now.plusHours(12).toInstant(), Duration.ofMinutes(90),11000|W)
    // log output will show Map with keys and values as String
    logInfo("TestEnergiBeregning", powerResult.toString)
end

I can see the spotprice for DK1 is in the new 15 minutes interval from 1. october.
Is there any option to keep / get the hourly spotprice for a while, until N1 allows for 15-minutes spotprice on my adress? To my understanding, the “old” 1 hour spotprice should be the average of the four 15 minutes periods for that particular hour.

Yeah, we got lucky with the transition to the new dataset, which seems to work. :slight_smile:

The old dataset is now discontinued, see the news quote in [energidataservice] Add support for day-ahead dataset with 15-minute resolution by jlaur · Pull Request #18695 · openhab/openhab-addons · GitHub

I have the same understanding, but don’t remember where I read that. I need to verify, and then think about the best way to provide such a calculation, i.e. whether to build that into the binding itself, or whether it can be accomplished in an elegant way outside of the binding. I’ll get back to this thread regarding this. I don’t think my contract is automatically changed to the new resolution, so I probably have the same need.

1 Like

Here is how Andel Enrgi handles 15min vs 1hour price: Andel timepris vs 15 min
”… Fra 1. oktober beregnes timeprisen på TimeEnergi som gennemsnittet af de fire gange 15 minutter i den pågældende time. …”

Is this the reason why I get no spotprices as of today using openHAB 4.3.4?

Yes, openHAB 4.3.4 was released 30.03.2025 and the new dataset was announced by Energinet 08.05.2025. You need to upgrade to 4.3.6.

Okay, thanks.. Is 4.3.6 jar file located somewhere?
I might upgrade my system to 4.3.7 (latest 4.x version). But I need to take some time, as I cant do it the usual way via openhabian.

You could have a look here: Update to 4.3.6 NOT 5.0.0

1 Like

I will give it a try, thanks.

Im at 4.3.7-1 now, and it seems to work fine again.. Thanks Jacob.

1 Like

Hey Jacob. I think I was a bit to fast.

Seems like I get a UNDEF return from the channel: energidataservice:service:9cb682c5e9:electricity#grid-tariff

Is there any specific changes in this one?

This is my items:

Number:EnergyPrice SpotPriceA              "Current Spot Price [%.2f kr]"          <price>   (TotalPriceA)       { channel="energidataservice:service:9cb682c5e9:electricity#spot-price" [profile="transform:VAT"] }
Number:EnergyPrice NetTariffA              "Current Grid Tariff [%.2f kr]"          <price>   (TotalPriceA)       { channel="energidataservice:service:9cb682c5e9:electricity#grid-tariff" [profile="transform:VAT"] }
Number:EnergyPrice SystemTariffA           "Current System Tariff [%.2f kr]"       <price>   (TotalPriceA)       { channel="energidataservice:service:9cb682c5e9:electricity#system-tariff" [profile="transform:VAT"] }
Number:EnergyPrice ElectricityTaxA         "Current Electricity Tax [%.2f kr]"     <price>   (TotalPriceA)       { channel="energidataservice:service:9cb682c5e9:electricity#electricity-tax" [profile="transform:VAT"] }
Number:EnergyPrice TransmissionNetTariffA  "Current Transmission Tariff [%.2f kr]" <price>   (TotalPriceA)       { channel="energidataservice:service:9cb682c5e9:electricity#transmission-grid-tariff" [profile="transform:VAT"] }

There shouldn’t be. Are you sure that it worked before the update? Can you show your Thing configuration, i.e. which grid company you have configured?

Hope this is the thing config.. I have created it in the main UI.. My items are in the old way (file).

UID: energidataservice:service:9cb682c5e9
label: Energi Data Service
thingTypeUID: energidataservice:service
configuration:
  gridCompanyGLN: "5790000705184"
  energinetGLN: "5790000432752"
  priceArea: DK2
  currencyCode: DKK
  reducedElectricityTax: true
channels:
  - id: electricity#spot-price
    channelTypeUID: energidataservice:spot-price
    label: Spot Price
    description: Spot price in DKK or EUR per kWh.
    configuration: {}
  - id: electricity#grid-tariff
    channelTypeUID: energidataservice:datahub-price
    label: Grid Tariff
    description: Grid tariff in DKK per kWh.
    configuration: {}
  - id: electricity#system-tariff
    channelTypeUID: energidataservice:datahub-price
    label: System Tariff
    description: System tariff in DKK per kWh.
    configuration: {}
  - id: electricity#transmission-grid-tariff
    channelTypeUID: energidataservice:datahub-price
    label: Transmission Grid Tariff
    description: Transmission grid tariff in DKK per kWh.
    configuration: {}
  - id: electricity#electricity-tax
    channelTypeUID: energidataservice:datahub-price
    label: Electricity Tax
    description: Electricity tax in DKK per kWh.
    configuration: {}
  - id: electricity#reduced-electricity-tax
    channelTypeUID: energidataservice:datahub-price
    label: Reduced Electricity Tax
    description: Reduced electricity tax in DKK per kWh. For electric heating
      customers only.
    configuration: {}
  - id: electricity#co2-emission-prognosis
    channelTypeUID: energidataservice:co2-emission
    label: CO₂ Emission Prognosis
    description: Estimated prognosis for CO₂ emission following the day-ahead market
      in g/kWh.
    configuration: {}
  - id: electricity#co2-emission-realtime
    channelTypeUID: energidataservice:co2-emission
    label: CO₂ Emission Realtime
    description: Near up-to-date history for CO₂ emission from electricity consumed
      in Denmark in g/kWh.
    configuration: {}
  - id: electricity#event
    channelTypeUID: energidataservice:event
    label: Begivenhed
    description: Begivenhed udløst
    configuration: {}

OK, this has been broken for you since June 1st, where Cerius made a change in the way they publish their prices:

I have updated the filter here:

Until next patch release, you can configure your channel to accomodate for this change:

For file-based configuration, see Energi Data Service - Bindings | openHAB and Energi Data Service - Bindings | openHAB

1 Like