EntsoE Binding [4.0.0.0;4.3.0.0)

I created pull request to fix the documentation: Remove wrappers from inline transformation documentation examples by masipila · Pull Request #2406 · openhab/openhab-docs · GitHub

Hi, everyone.

I have a suggestion for this amazing initiative. I believe not every potential user knows what ENTSO-E (such as me before I got to this thread) is, so they may not discover the binding. Wouldn’t it make sense to append something more descriptive to the binding’s name, such “… Energy Spot Prices”, or “… Energy Management”, or “… Energy Consumption Management”, etc..

Even if people don’t know what ENTSO-E is about, the “Energy” keyword may help more users discover the binding.

I understand your suggestion, but I’m not sure renaming the binding is the right solution. See:
https://github.com/openhab/openhab-addons/pull/17747

and more importantly:
https://github.com/openhab/openhab-webui/issues/2870

Adding keywords to binding name seems like a work-around for not having either defined keywords in metadata or using the description for search. See for example ENTSO-E’s description:

For a binding like Energi Data Service it would be awkward adding “Energy” to the binding name when it already contains for Danish word “Energi”, although users might be searching in English:

Agree.
People that can make use of it will know what Entso-E actually is.

Before answering, I want to clarify that I’m not proposing a change to the artifact’s name.

I sense a potential expert bias here.

I wouldn’t have suggested the same for that binding. It’s quite clear that “Energi” could be related to “Energy”. Even linguistically speaking it’s 86% related. Plus the binding’s name is a mix of a word in some language (or a typo) and English words, hinting that is something specific to the country where that language is spoken. If that binding had a broader reach outside Denmark, I would have suggested naming it in English.

About the enhancement to extend the search to use binding descriptions, it’s not clear when or if it will be implemented. There is already a comment against it.

My point is, don’t just assume that this binding can be used only/mainly by people who know Entso-E, but try to make finding and “understanding” (“Entso-what? Prolly Wall-E’s brother” → “Entso-E European Spot Energy Prices. Wow, I may use it to reduce some costs.”) it as simple as possible for anyone looking for something similar. I believe this could be part of the OH offer to Home Energy Management, at least in Europe, and perhaps a source of inspiration to develop similar solutions for other countries.

I hope I can simply illustrate it with a comparison:

versus

It actually takes a lot more to benefit from dynamic pricing than only to deploy the binding, and there’s other, equally well suited tariff provider specific bindings to accomplish the same, so Entso-E is neither the binding of choice nor is it fair to rank the others down which is what would happen with your proposal.
and that’s mutually exclusive.
Users will have to dig into all of this first, and if you decide to, you will quickly learn about what Entso-E is anyway.

Expert yes, I’ve developed a (commercial) energy management system based on OH to use this and other bindings so yes I know what I’m talking about.
Bias, no.

Oh are there more? Cool. The more the merrier.

When did I explicitly or implicitly say that it should rank higher than similar solutions, or that others should be ranked down, to put it in your same words?

Clearly, an American user wouldn’t care about any European data provider.

My proposals, to avoid assumptions, are:

  1. This (and every single binding) should have a proper name. This is just a suggestion, not a mandate. Of course, if you would like to call your binding “Mstormi Binding” (this is just an example) and think that’s enough to attract users, no one can force you to rename it. But then don’t complain if it doesn’t “rank” higher.
  2. There should be a place on the website where all energy-management-related solutions (free and commercial, yes, yours too) supported by OH are displayed in an easy-to-find and clear way, so users don’t need to get a shovel and dig everything up on their own. Then users would go research and implement whatever they please.

How so?

That isn’t related/restricted to energy management. Applies to any other home automation area as well that OH covers.
And with the exception of commercial solutions, it already is implemented:
binding search, including marketplace search options, will find you what you’re looking for.

You may argue that binding descriptions should be improved to enhance that and I agree, maybe they should include better tagging.
But in the first place, that’s how OH works in general and has ever been so and there’s no good reason to start changing that in the energy management context.
Here, too, you need to inform yourself first and generate a design idea of what you are looking for before you go looking for how to implement that in OH.
And if you have started to read into any such area and came up with the attention it takes if you want to take on a huge-scale and complex area like energy management, you will have come across Entso-E, too.

If your tariff provider is Tibber or aWATTar, your only source of truth to optimize power cost should be the Tibber or aWATTar binding’s price information. That’s not exactly the same as generic stock exchange energy prices which are what Entso-E will provide you.

@laursen I’m having quire weird observations with the prices-received trigger channel.

I’m suspecting that trigger is invoked before the spot prices have been successfully persisted to the my Item.

Test steup:

  • openHAB 4.3.0.M4 running in Docker
  • InfluxDB 2 running in Docker
  • I have configured the EntsoE binding to fetch data 3 days from the past and have an Item called SpotPrice with persistence policy forecast. I can see that the day-ahead prices are persisted nicely.
  • I have a Rule which is invoked from the prices-received channel trigger
  • The inline script action for the rule is below. The window is “today” and not “tomorrow” so that this repro works also when tomorrow’s prices have not been published yet.
var start = time.toZDT('00:00');
var end   = start.plusDays(1);
var spotItem = items.getItem('SpotPrice');
var spotPrices = spotItem.persistence.getAllStatesBetween(start, end);
console.log(spotPrices);

Observation:

  • The spotPrices array is empty when the Rule is invoked from the prices-received trigger
  • If I run the rule manually, the array contains the PersistedItem objects as exepcted

So the only thing that I can think of is that my Rule gets invoked before the prices have been written to the persistence service. Which might well be by design and how openHAB works.

Question 1: can you confirm that this is the case?

Question 2: what kind of retry mechanism does the binding have if the publishing of the prices is delayed in EntsoE or the internet connection of the openHAB server is down when the binding tries to fetch the prices (I can see that there is an advanced configuration parameter “publish hour” which has a sensible default).

Cheers,
Markus

Yes, I can confirm that. Items are persisted asynchonously, so there is no way of waiting for it or knowing when it’s done. I regret providing this naive example:

In my own setup I have this:

function persistTotalPrices() {
    var timeSeries = new items.TimeSeries('REPLACE');
    var start = time.LocalDate.now().atStartOfDay(time.ZoneId.systemDefault());
    var spotPrices = items.EnergiDataService_SpotPrice.persistence.getAllStatesBetween(start, start.plusDays(2));
    for (var spotPrice of spotPrices) {
        var totalPrice = spotPrice.quantityState
            .add(items.EnergiDataService_GridTariff.persistence.persistedState(spotPrice.timestamp).quantityState)
            .add(items.EnergiDataService_SystemTariff.persistence.persistedState(spotPrice.timestamp).quantityState)
            .add(items.EnergiDataService_TransmissionGridTariff.persistence.persistedState(spotPrice.timestamp).quantityState)
            .add(items.EnergiDataService_ElectricityTax.persistence.persistedState(spotPrice.timestamp).quantityState)
            .add(items.EnergiDataService_ElectricitySupplierFee.persistence.persistedState(spotPrice.timestamp).quantityState);

        timeSeries.add(spotPrice.timestamp, totalPrice);
    }
    items.EnergiDataService_TotalPrice.persistence.persist(timeSeries);
}

rules.when()
    .channel('energidataservice:service:energidataservice:electricity#event').triggered('DAY_AHEAD_AVAILABLE')
    .then(event => {
        // Short delay because persistence is asynchronous.
        setTimeout(() => {
            persistTotalPrices();
        }, 5000);
    })
    .build("Persist total electricity prices", "Work-around for group aggregation not supporting support time series");

I don’t remember the ENTSO-E retry mechanism in details, you could have a look here:

And maybe for inspiration if someone would like to make it more advanced:

I’m having some issues with the EntsoE binding under OH4.2.1. I have downloaded the jar-file from Github (v4.3.0). My configuration is shown in the screen copy below:

The problem is that the Item Dayahead_prices_Spot_Price seems to have only the current price for the electricity but not tomorrow’s prices. I’m persisting the values to InfluxDB but it has only the current and old values. Any ideas what I’m missing?

Another issue is that when I try to link the other channel Trigger Prices Received to a new Item I get the following message:

Any ideas what I’m missing?

Did you remember to set the persistence policy to forecast for this Item? It can done either in the UI or via the file configuration.

If you’re using the Main UI, it can be found in Settings / Influx DB Persistence and then there is a big button on the top of the screen for configuring the persistence policies.

You’re not expected to create Items for Trigger channels. The Rule can be invoked so that in the Rule “When” section, you select a “Thing event”, then select your Day-ahead Thing, and then select the channel that new prices have been received.

Markus

Thanks for the pointer!

If I’m interpreting the code correctly, the binding schedules a retry after 5 minutes if the prices could not be fetched?

I think it’s this piece of code:

Thanks. OK, I had forgotten to set forecast. Persisting doesn’t still seem to work properly because in the OH log I get a message:

2024-12-01 18:40:45.076 [WARN ] [.thing.internal.CommunicationManager] - Profile 'transform:JS' on channel entsoe:day-ahead:9d1c752604:spot-price does not support time series.

So i installed the binding and got my API key.
When configurating the thing the Danish key is unknown, Let me specify more clearly. There are an language key which is valid (10Y1001A1001A65H) but this has no data.
and there are 2 area keys which has data : 10YDK-2--------M for East part and 10YDK-1--------W for West part.
found them here: area codes
and tested using this link: https://web-api.tp.entsoe.eu/api?securityToken=THEAPIKEY&documentType=A65&processType=A16&outBiddingZone_Domain=10YDK-2--------M&periodStart=202411282300&periodEnd=202412012300
Can someone add the two danish keys to the binding?

These are already included in the options list:

  • 10YDK-1--------W
  • 10YDK-2--------M

Well, just tried updating Openhab and the binding.
I’m using openhab 4.2.3…
The issue persist. when using the codes the binding info tells me what values are allowed: this is what is returned:

Status: 
UNINITIALIZED
HANDLER_CONFIGURATION_PENDING
{area=Værdien 10YDK-2--------M stemmer ikke overens med tilladte valgmuligheder parameter. Tilladte valgmuligheder er: [ParameterOption [value="10Y1001A1001A65H", label="Denmark (DK)"], ParameterOption [value="10Y1001A1001A83F", label="Germany (DE)"], ParameterOption [value="10Y1001A1001A92E", label="United Kingdom (UK)"], ParameterOption [value="10Y1001A1001A93C", label="Malta (MT)"], ParameterOption [value="10Y1001A1001A990", label="Moldova (MD)"], ParameterOption [value="10Y1001A1001B004", label="Armenia (AM)"], ParameterOption [value="10Y1001A1001B012", label="Georgia (GE)"], ParameterOption [value="10Y1001A1001B05V", label="Azerbaijan (AZ)"], ParameterOption [value="10Y1001C--00003F", label="Ukraine (UA)"], ParameterOption [value="10Y1001C--00100H", label="Kosovo (XK)"], ParameterOption [value="10YAL-KESH-----5", label="Albania (AL)"], ParameterOption [value="10YAT-APG------L", label="Austria (AT)"], ParameterOption [value="10YBA-JPCC-----D", label="Bosnia and Herz. (BA)"], ParameterOption [value="10YBE----------2", label="Belgium (BE)"], ParameterOption [value="10YCA-BULGARIA-R", label="Bulgaria (BG)"], ParameterOption [value="10YCH-SWISSGRIDZ", label="Switzerland (CH)"], ParameterOption [value="10YCS-CG-TSO---S", label="Montenegro (ME)"], ParameterOption [value="10YCS-SERBIATSOV", label="Serbia (RS)"], ParameterOption [value="10YCY-1001A0003J", label="Cyprus (CY)"], ParameterOption [value="10YCZ-CEPS-----N", label="Czech Republic (CZ)"], ParameterOption [value="10YFI-1--------U", label="Finland (FI)"], ParameterOption [value="10YFR-RTE------C", label="France (FR)"], ParameterOption [value="10YGR-HTSO-----Y", label="Greece (GR)"], ParameterOption [value="10YHR-HEP------M", label="Croatia (HR)"], ParameterOption [value="10YHU-MAVIR----U", label="Hungary (HU)"], ParameterOption [value="10YIE-1001A00010", label="Ireland (IE)"], ParameterOption [value="10YIT-GRTN-----B", label="Italy (IT)"], ParameterOption [value="10YLT-1001A0008Q", label="Lithuania (LT)"], ParameterOption [value="10YLU-CEGEDEL-NQ", label="Luxembourg (LU)"], ParameterOption [value="10YLV-1001A00074", label="Latvia (LV)"], ParameterOption [value="10YMK-MEPSO----8", label="North Macedonia (MK)"], ParameterOption [value="10YNL----------L", label="Netherlands (NL)"], ParameterOption [value="10YNO-0--------C", label="Norway (NO)"], ParameterOption [value="10YPT-REN------W", label="Portugal (PT)"], ParameterOption [value="10YRO-TEL------P", label="Romania (RO)"], ParameterOption [value="10YSE-1--------K", label="Sweden (SE)"], ParameterOption [value="10YSI-ELES-----O", label="Slovenia (SI)"], ParameterOption [value="10YSK-SEPS-----K", label="Slovakia (SK)"], ParameterOption [value="10YTR-TEIAS----W", label="Turkey (TR)"], ParameterOption [value="BY", label="Belarus (BY)"], ParameterOption [value="RU", label="Russia (RU)"], ParameterOption [value="IS", label="Iceland (IS)"]]}

I don’t know which version of the binding you are using. If it’s the community version from this thread, I’m not sure if anyone is still maintaining it? If you have the issue with the current version of the binding from the latest 4.3 milestone, please let me know.

ohh Just realised that it require oh 4.3 :sweat_smile:
I was on main release so switched to testing. That did the trick.

I have now installed OH4.3.0 and managed to get the EntsoE binding working. My problem was that I used the VAT calculation below.

It seems that this is not working for me. On the other hand it seems that the prices I get from Entso include VAT. My energy company adds a fee to the SPOT prices and I’m now wondering how to add the fee to the prices. I tried to make a Gain-Offset Correction (see the screen copy) but doesn’t work at least for the values in InfluxDB.