Im lost here and therefore need some help/advice. (sorry for the long post).
As this is mainly regarding the Energi Data Service from @laursen he could come in hand.
Problem:
I want to show a chart on my page (dashboard, created in MainUI) for future upcoming prices (totalPrise). Atm I have the current totalprice showen. And when I click on it, it shows the build-in chart of the daily history. This is basicly my knowlegde in openHAB.
But I would like to show the furture price.
I have read the description of Energi Data Service binding aprox a zillion times. This feature is mentioned, but I simply dont get it. I have no idea where to start, whats required and whats not required to do this. I know that Energi Data Service binding do collect the future prices. I just dont seem to understand, how to get those data to a chart. Or if it even do collect the data by default.
I use the default items setup from the binding: (items file).
Group:Number:EnergyPrice: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> { channel="energidataservice:service:9cb682c5e9:electricity#reduced-electricity-tax" [profile="transform:VAT"] }
I run a standard openhabian setup with openHAB 5.1 which uses Rrd4j database.
I did try install the inMemory, as suggested in the binding description, but it gave me some other problems, and never actually helped me in my lack of understading, how to get the data from the binding into the chart. So I switched back to use Rrd4j as the default. I have no idea if it will work or not.
Status right now:
I have the binding running, it collected current data, and I think it collects furture data as well (im not sure though). I have the rule running to update for future data, I think. Simply by copying the rule from the binding description (JavaScript) for the time series. I do wonder though, how its triggered as there is no trigger in the rule. Its unclear to me, if this is triggered automactily from the binding when âDAY-AHEAD-AVAILABLEâ is âavailableâ.
Rule:
rules.when()
.channel('energidataservice:service:energidataservice:electricity#event').triggered('DAY_AHEAD_AVAILABLE')
.then(event => {
// Short delay because persistence is asynchronous.
setTimeout(() => {
var timeSeries = new items.TimeSeries('REPLACE');
var start = time.LocalDate.now().atStartOfDay().atZone(time.ZoneId.systemDefault());
var spotPrices = items.SpotPrice.persistence.getAllStatesBetween(start, start.plusDays(2));
for (var spotPrice of spotPrices) {
var totalPrice = spotPrice.quantityState
.add(items.GridTariff.persistence.persistedState(spotPrice.timestamp).quantityState)
.add(items.SystemTariff.persistence.persistedState(spotPrice.timestamp).quantityState)
.add(items.TransmissionGridTariff.persistence.persistedState(spotPrice.timestamp).quantityState)
.add(items.ElectricityTax.persistence.persistedState(spotPrice.timestamp).quantityState);
timeSeries.add(spotPrice.timestamp, totalPrice);
}
items.TotalPrice.persistence.persist(timeSeries);
}, 5000);
})
.build("Calculate total price");
If I have this figured corectly. Then - Whats next? How do I get this into a chart?
I would be greatfull if anyone can help with a step by step process to archive this task.
Please keep it as simple as possible. This will have to be a learning curve to me, as I intend to extend this to more complex use of the future price. (like having the washingmachine start a the lowest price, etc). So I need to understand/learn, rather than just be given the solution, and still not having a clue whats going on ![]()
Thanks in advance.









