Dynamic Electricity rates

Hi, I am trying to get the dynamic electricity rate available in OpenHAB as a basis for energy consumption steering.
In the I used their JSON directly to get the data, but this stopped working since a few months asking for a additional inputs. Can’t figure them out and the helpdesk is not able to provide them… https://api.engie.be/engie/ms/pricing/v1/public/prices/epex

I shifted to try to use the online Excel which is updated daily, but can figure out how to handle/read an excel file in a rule.

https://www.engie.be/api/engie/be/ms/pricing/public/v1/epex-prices/export?exportType=XLSX

Does anybody have an example or some tips if this possible in a rule?

thanks
Uitgeslapen

You could check the Entsoe binding if this is an easier approach to get dynamical prices.

You are likely going to need to find a Ruby, node.js, or Python library that can parse XLSX which means you’ll need to use the jRuby, JS Scripting, add-ons or HABApp third partry service to implement this in a rule.

I don’t suppose you can use CSV as an export type? That would be easier as it’ll be plain text (no special parser required) and can likely be handled in a standard rule using string manipulation only.

Here is a tested working code written in JRuby:

gemfile do
  source "https://rubygems.org"
  gem "rubyXL"
end

uri = URI("https://www.engie.be/api/engie/be/ms/pricing/public/v1/epex-prices/export?exportType=XLSX")
data = Net::HTTP.get(uri)

workbook = RubyXL::Parser.parse_buffer(data)
sheet = workbook[0]

cost_array = (4..27).map { |row| sheet[row][1].value }
logger.info cost_array

Output:

[116.94, 111.36, 108.04, 99.02, 93.44, 91.55, 93.23, 102.7, 114.26, 125.36, 121.5, 109.13, 110.01, 107.95, 104.07, 103.67, 112.29, 123.88, 129.5, 126.3, 110.29, 114.48, 124.69, 104.99]

@uitgeslapen you might be interested in this solution so that you don’t need to building everything from scratch.

Cheers,
Markus

This has been merged into the official openhab distribution.

https://next.openhab.org/addons/bindings/entsoe/

1 Like

Thanks! Installed the Entsoe binding and subscribed to the site. Quick solution out-of-the-box!

1 Like