Read current energy price from Engie Electrabel

Hi,

I’m looking for a way to import the current energy price from Engie Electrabel
I’ve seen on their website they’re using a sort of API to retrieve the data:
https://www.engie.be/api/engie/be/ms/billing/customer/v1/business-agreements/xxxxxxxxxx/energy-prices?maxGranularity=MONTHLY
But it also require an authentication.

Did anyone already made an integration for this? Or did someone started this already?

hi @ewoudsmets any news on this? i’m in the same position to scrape the data from this page for dynamic prices, but unfortunetly, won’t work.

DId you found a solution ?

Hi,

I’ve been looking at this too.
Unfortunately you need a Bearer token (only valid for temporarily), which you can get with a request to:

https://account.engie.be/auth/realms/BE_MS_Customers/protocol/openid-connect/token

The request is using following parameters: (and I can’t figure out where they are from) - they are not my username and password.

The reply will contain the token. With that token you can call the energy_prices-API

Any help is much appreciated!

Best regards,
Ruben

This is a screenshot of the reply:

Hello @rubendewasch, @ewoudsmets,

Engie belgium seem to be using Auth0 as a identity provider. You can find more information about the authentication flow in their documentation. Based on your screenshots, it seems that they use a “Authorization Code Flow”. The doc is here: Authorization Code Flow Documentation

In the meantime, you can see that there is a “refresh-token” in the screenshot. You can use that refresh-token to get a new access-token once this one expires.

I am interested in finding out how to scrape that data and inject it in Home Assistant. If more people are interested, I can work on a python package to do so which could then be transformed into an integration.

Hope this helped!

Kind regards,
Guillaume

2 Likes

Also interessed. Maybe I can help to test?

Hi all, I needed this as well so I spent some time reverse-engineering their platform. I’m planning to publish my integration on HACS soon but I would like to have it tested by other people first.

A few things to note:

  • Currently, only 2FA via SMS is supported. I might add support for email 2FA in the future. Passkeys and itsme support are off the table, not interested in touching those. I’m also not sure what will happen when ENGIE forces 2FA on all of their customers in March.
    EDIT: I also added support for e-mail 2FA.
  • I was only able to test with Easy Variabel. The API call for prices uses MONTHLY for maxGranularity, so this might not be ideal for people with a dynamic contract.

  • ENGIE seems to be very strict with their access tokens: they get revoked after about 2 minutes, so the integration refreshes the token every minute in the background. There is a binary sensor to keep track of the authentication status.

  • The integration creates sensors for offtake and injection prices (both including and excluding VAT), per EAN. Injection sensors are only created when the data is available (e.g. gas will only have offtake).

For those interested in the login flow, I’ve included a Bruno collection in the repository.

Feel free to test this out by spinning up the devcontainer, all contributions and improvements are welcome :smile: