Energi Data Service Binding [4.0.0.0;4.1.0.0)

Hmm.. Have to be honest. I have mostly paid attention to spotprice. In my dashboard I have spotprice and total price. Now you mention it, I did notice a lower total price some time ago, but didnt pay that enough attention, since the spotprice was showing fine..
Then I updated openhab and notices the grid tarif where no longer defined.

Anyway, edited the channel as showen above, and now I get the frid tarif just fine again.. Thanks.

Hi @laursen

As mentioned in another thread, there are a few things I dont understand. Sorry this is a bit long, but there are lots of things to check/explain :slight_smile:

First - I´m not sure if this is an Energi Data Service issue, or if its “Energi Fyn” issue, (or cause by something else). Its not a huge issue. Its just that I´m trying to understand and find the reason, why the prices are not equal for “Energi Fyn” and Energi Data Service.

I have a deal with Energi Fyn for delivering power. The deal is, I pay the spotprice +0,5 kroner/pr day. (I know, its a stupid price to calculate, but thats how it is). Beside that, I pay the usual taxes and Tariff.
The Grid company is Cerius.
I believe I have setup Energi Data Service correctly with all required informations incl VAT.

Energi Fyn has its own app where is shows me the prices based on my deal with them.
They also know who the grid company is.
Unfortunatly Energi Fyn app can only show me the totalprice (including VAT) or the spotprice/pr hour (including VAT). I can not see the GridTariff, SystemTarif, TransmissionTariff or ElectricityTax.
Tax, as you know, is no longer highly relevant, as it has been reduced to absolute minimum (0,01 kroner/kWh).

Here are some screendumps taken today, 28.01.2026 at 09.28.

First two from Energi Fyn app showing totalprice and spotprice.
And last a screenfump from openhab mobile app (BasicUI).
Please notice the differences in totalprice as there seem to be a rather big differences.
EnergiDataService = 2,47 kr/kWh
Energi Fyn = 2,18 kr/kWh

Second notice the spotprice.
EnergiDataService = 1,68 kr/kWh
Energi Fy = 1,63 kr/kWh

Spotprice:
I havnt verify this value at Nordpool. Thats because Energi Fyn uses (avarage) hourly spotprice. But EnergiDataService uses quarter/hour spotprice. That makes at a bit of a mess.
I believe EnergiDataService is correct at 1,68 kroner/kWh

GridTariff: (Grid provider)
According to Cerius.dk the Tariff should be 0,3992 kroner (or 39,92øre/kWh) between 06-17 o´clock. But looking at openHAB screendump EnergiDataService says 0,63 kroner. (63øre/kWh).
Thats a difference of 23,08 øre/kWh which is rather high.

System & TransmissionsTariff: (EnergiNet)
Now things gets a bit complicated. I have simply given up finding the correct prices at EnergiNet. Its a total mess specially since there is another Tariff called “Indfødnings Tariff” for costumors who has a solar system and grid feed-in.
I have not taken “Indfødningstariff” into account. EnergiNet do not have prices including VAT. I have no idea why though. Here is the prices from EnergiNet.
NetTariff = 4,3øre/kWh (ex VAT) (5,375 øre/kWh incl VAT).
SystemTariff = 7,2øre/kWh (ex VAT) (9 øre/kWh incl VAT).

ElectricityTax:
Is not that relevant since EnergiDataService is correct at 0,01, but stil have the higest totalprice.

Conclusion:
It seems like EnergiDataService got Spot, System, Transmission & ElectricityTax correct.
But the GridTariff is wrong/different for Cerius costumors.

The wrong/different GridTariff, the hourly/quaterly spotprice and the daily adds to spotprice for “Energi Fyn” costumors may explain the differences in the totalPrice between EnergiDataService and “Energi Fyn”. Can you verify that the GridTariff is wrong?

(When I get back at home, I will tripple check that EnergiDataService has been setup correctly for Cerius).

The binding correctly shows the price they have published:

Persisted with VAT:

image

You did not show your configuration, so I can’t know why you are seeing 0,63 kr.

I know.. I just got back home :slight_smile:

This is my config for the binding:

version: 1
things:
  energidataservice:service:9cb682c5e9:
    config:
      priceArea: DK2
      currencyCode: DKK
      gridCompanyGLN: 5790000705184
      energinetGLN: 5790000432752
      reducedElectricityTax: true
    channels:
      electricity#spot-price:
        type: spot-price
        label: Spot Price
        description: Spot price in DKK or EUR per kWh.
      electricity#grid-tariff:
        type: datahub-price
        label: Grid Tariff
        description: Grid tariff in DKK per kWh.
        config:
          notes: "Nettarif C,Nettarif C time"
      electricity#system-tariff:
        type: datahub-price
        label: System Tariff
        description: System tariff in DKK per kWh.
      electricity#transmission-grid-tariff:
        type: datahub-price
        label: Transmission Grid Tariff
        description: Transmission grid tariff in DKK per kWh.
      electricity#electricity-tax:
        type: datahub-price
        label: Electricity Tax
        description: Electricity tax in DKK per kWh.
      electricity#reduced-electricity-tax:
        type: datahub-price
        label: Reduced Electricity Tax
        description: Reduced electricity tax in DKK per kWh. For electric heating customers only.
      electricity#co2-emission-prognosis:
        type: co2-emission
        label: CO₂ Emission Prognosis
        description: Estimated prognosis for CO₂ emission following the day-ahead market in g/kWh.
      electricity#co2-emission-realtime:
        type: co2-emission
        label: CO₂ Emission Realtime
        description: Near up-to-date history for CO₂ emission from electricity consumed in Denmark in g/kWh.
      electricity#event:
        type: event

And these are my items:

Group:Number:SUM TotalPrice "Total Price [%.2f kr]" <price>

Number:EnergyPrice SpotPrice                "Spot Price"                <price> (TotalPrice)                                        { channel="energidataservice:service:9cb682c5e9:electricity#spot-price" [profile="transform:VAT"] }
Number:EnergyPrice GridTariff               "Grid Tariff"               <price> (TotalPrice)                                        { channel="energidataservice:service:9cb682c5e9:electricity#grid-tariff" [profile="transform:VAT"] }
Number:EnergyPrice SystemTariff             "System Tariff"             <price> (TotalPrice)                                        { channel="energidataservice:service:9cb682c5e9:electricity#system-tariff" [profile="transform:VAT"] }
Number:EnergyPrice TransmissionGridTariff   "Transmission Grid Tariff"  <price> (TotalPrice)                                        { channel="energidataservice:service:9cb682c5e9:electricity#transmission-grid-tariff" [profile="transform:VAT"] }
Number:EnergyPrice ElectricityTax           "Electricity Tax"           <price> (TotalPrice)                                        { channel="energidataservice:service:9cb682c5e9:electricity#reduced-electricity-tax" [profile="transform:VAT"] }

This is the value GridTariff right now (at kl 23.19):

According to Cerius it should be 39,92 øre/kWh from kl 21 - 24.

Delete the channel configuration.

Just to make sure. I just checked with eloverblik.dk.
This is the data from price sheet:

Delete it? How?

Either delete the two lines directly from the code tab:

Or UI:

Hmm.. I deleted from the code tab. Restarted the binding. Now I get this error:

2026-01-28 22:44:03.753 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'energidataservice:service:9cb682c5e9': Maximum length exceeded: 5.790000705184E12
java.lang.IllegalArgumentException: Maximum length exceeded: 5.790000705184E12
	at org.openhab.binding.energidataservice.internal.api.GlobalLocationNumber.<init>(GlobalLocationNumber.java:37) ~[?:?]
	at org.openhab.binding.energidataservice.internal.api.GlobalLocationNumber.of(GlobalLocationNumber.java:83) ~[?:?]
	at org.openhab.binding.energidataservice.internal.config.EnergiDataServiceConfiguration.getGridCompanyGLN(EnergiDataServiceConfiguration.java:65) ~[?:?]
	at org.openhab.binding.energidataservice.internal.handler.EnergiDataServiceHandler.initialize(EnergiDataServiceHandler.java:150) ~[?:?]
	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[?:?]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:149) ~[?:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) ~[?:?]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?]
	at java.lang.Thread.run(Unknown Source) [?:?]
==> /var/log/openhab/events.log <==
2026-01-28 22:44:03.760 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'energidataservice:service:9cb682c5e9' changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR): Maximum length exceeded: 5.790000705184E12
==> /var/log/openhab/openhab.log <==
2026-01-28 22:44:03.760 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'energidataservice:service:9cb682c5e9': Maximum length exceeded: 5.790000705184E12
java.lang.IllegalArgumentException: Maximum length exceeded: 5.790000705184E12
	at org.openhab.binding.energidataservice.internal.api.GlobalLocationNumber.<init>(GlobalLocationNumber.java:37) ~[?:?]
	at org.openhab.binding.energidataservice.internal.api.GlobalLocationNumber.of(GlobalLocationNumber.java:83) ~[?:?]
	at org.openhab.binding.energidataservice.internal.config.EnergiDataServiceConfiguration.getGridCompanyGLN(EnergiDataServiceConfiguration.java:65) ~[?:?]
	at org.openhab.binding.energidataservice.internal.handler.EnergiDataServiceHandler.initialize(EnergiDataServiceHandler.java:150) ~[?:?]
	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[?:?]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:149) ~[?:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) ~[?:?]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?]
	at java.lang.Thread.run(Unknown Source) [?:?]

Restoring the config (including thw two lines) still give the same error.. :thinking:

Seems like you might have hit a bug in the YAML parser used by the code tab. Go to your Thing configuration and reconfigure your grid company.

Done, and binding is running again (without those two lines).
You´re right.. When I removed the two lines, it changed the GLN numbers for both the elselskab and energinet.. Weird!

And.. Now GridTarif is showing correctly :slight_smile:

Total price match Energi Fyn with 1 øre in a difference.. I can live with that :sweat_smile:

Are you able to reproduce this issue? I cannot reproduce in 5.1.1 or latest 5.2 snapshot. In both versions, this is how the GLN parameters look like in YAML in the code tab:

      gridCompanyGLN: "5790001089030"
      energinetGLN: "5790000432752"

When saving that back, I don’t have any issues. I could see how it might cause the exception you mentioned if the GLN’s wouldn’t have quotes around them. In 5.2 I tried to remove the quotes, but even then couldn’t reproduce it - they are normalized back to having them.

That can possibly be explained by:

Both are correct. The Energi Data Service spotprice is the market price, but you probably have a contract where you pay the hourly average. So that average is correct as well, because that’s what you actually pay.

Yep, it happens every time I makes any changes from the code tab.
It changes the GLN numbers and I have to manuel insert them again from the Thing tab.

I run openHAB 5.1

      gridCompanyGLN: 5.790000705184E12
      energinetGLN: 5.790000432752E12
      reducedElectricityTax: true

Will it be possible to change the binding to do average hourly spotprices (as an option) ?

Oh, that explains it. This is fixed in 5.1.1: [YAML] Use quotes for numbers stored as strings when generating YAML by lolodomo ¡ Pull Request #5241 ¡ openhab/openhab-core ¡ GitHub

Yes, I’m working on that, albeit rather slowly. :wink: It was already brought up in this chat: Energi Data Service Binding [4.0.0.0;4.1.0.0) - #68 by andreasdk

Great.. Now we know why :slight_smile:

I did thought I saw it mentioned somewhere, but I couldnt find it.
Glad to hear you´re working (slowly) on the option :flexed_biceps:

I progressed a bit today and I think I’m now almost satisfied with it. If you want to give it a test run, here’s a JAR: org.openhab.binding.energidataservice-5.1.2-SNAPSHOT.jar

I’ve been running another build for quite some time. I have two Things configured: one with quarter-hourly prices and one with the hourly averages. The first one I’ve been using for persistence (to have the full dataset) and daily notifications, and the other one I’ve been using for calculations, because my contract is still based on hourly prices. The problem until today has been that the day-ahead prices were downloaded twice for no good reason. Now, the quarter-hourly prices will always be cached, and hourly prices will be recalculated from those and then cached separately for performance reasons.

@andreasdk - FYI also.

I will give it a try..
But I assume its gona take some changes to the rule as well?

EDIT.. Have it running now.
It did not needed any changes to the rule. I now have hourly total prices in my chart.. Much better.
I also verified the prices with Energi Fyn app. The data is equal. So thats perfect.

I installed the snapshot and can see the hourly spot-price now.
That’s perfect..
Thanks for your effort. :+1: