Can you send me this example ?
Or use ‘Postman’ to make the api documentation public ?
Or Some Github public repo ?
Thanks,
Can you send me this example ?
Or use ‘Postman’ to make the api documentation public ?
Or Some Github public repo ?
Thanks,
Contact me on the portal and I will reply by mail.
Follow this item
I actually found the internal API right in the network console after logging in.
You should be able to query:
(replace the XXX to fit your actual EAN number)
I used itsme to log in, and using a bearer token included in the requests I can make requests to this enpoint using postman:
Maybe if you create a login and password you can automate getting the token and making the request.
I made some steps, this script is able to get the current usage statistics for the current week:
It’s available on GitHub - sander110419/Fluvius_API: Access the Fluvius (Belgian energy network operator) "public"-ish API
or:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from seleniumwire import webdriver
import json
import requests
fluviuslogin = "[email protected]"
fluviuspassword = "yourfluviuspassword"
fluviusEAN = "the EAN you want to request the usage for" # example: 5414488200441000000
# Initialize Chrome WebDriver with performance logging enabled
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--enable-logging')
chrome_options.add_argument('--log-level=0')
chrome_options.add_argument('--headless')
chrome_options.set_capability('goog:loggingPrefs', {'performance': 'ALL'})
seleniumwire_options={ 'enable_har': True }
driver = webdriver.Chrome(options=chrome_options, seleniumwire_options=seleniumwire_options)
# Open the login page
driver.get('https://mijn.fluvius.be')
log_entries = driver.get_log("performance")
# Initialize dictionaries to store request and response headers
request_headers_data = []
response_headers_data = []
last_known_url = None # To keep track of the URL associated with the latest entry
# Wait for the button to be clickable
wait = WebDriverWait(driver, 10)
button = wait.until(EC.element_to_be_clickable((By.XPATH, '//button[@data-testid="b2c-account-type-selection-button-personal"]')))
# Find the button and click it
button = driver.find_element("xpath", '//button[@data-testid="b2c-account-type-selection-button-personal"]')
button.click()
# Wait for the email input field to be visible
wait = WebDriverWait(driver, 10)
email_input = wait.until(EC.visibility_of_element_located((By.ID, 'signInName')))
# Enter the email and password
email_input.send_keys(fluviuslogin)
password_input = driver.find_element(By.ID, "password")
password_input.send_keys(fluviuspassword)
# Click the login button
login_button = driver.find_element(By.ID, 'next')
login_button.click()
# Wait for the page to load and get the cookies
wait = WebDriverWait(driver, 200)
button = wait.until(EC.element_to_be_clickable((By.XPATH, '//button[@id="fluv-cookies-button-accept-all"]')))
button.click()
with open('output.json', 'w') as file:
file.write(driver.har)
# Load the JSON file
with open('output.json') as f:
data = json.load(f)
# Initialize a variable to store the authorization header
auth_header = None
# Loop through each entry in the log
for entry in data['log']['entries']:
# Loop through each header in the request
for header in entry['request']['headers']:
# Check if the header name is 'authorization' and starts with 'Bearer e'
if header['name'] == 'authorization' and header['value'].startswith('Bearer e'):
# If so, store it in our variable and break the loop
auth_header = header['value']
break
# Break the outer loop if we found an authorization header
if auth_header is not None:
break
# Print the authorization header
if auth_header is not None:
print(auth_header)
else:
print("No authorization header found.")
driver.quit()
# Use the token to make a request
# Define the URL
url = f'https://mijn.fluvius.be/verbruik/api/consumption-histories/{fluviusEAN}?historyFrom=2023-06-30T22:00:00Z&historyUntil=2024-07-07T22:00:00Z&granularity=3&asServiceProvider=false'
# Define the headers for the request
headers = {
'Authorization': auth_header,
}
# Make the GET request
response = requests.get(url, headers=headers)
# Print the response
print(response.json())
No idea if this can be turned into an addon like this.
Hello Umberto,
is there any chance that you could provide the same service for Brussels/Sibelga?
Thanks.
What is the status of your project?
is there already an update of the project ?
nice. a selenium based web scraper. was thinking of building the same ![]()
As a side note, i think indeed it is a disgrace Fluvius does not expose an API for regular customers. We pay Fluvius more then enough tax money for that.
But hey, if they don’t want to listen, this is the result: their web page will be scraped. This also generates load and cost for them. They don’t seem to realise an API can in fact be much ‘leaner’ and cost less, in the end …
Dongle in P1 et voila …
It took a while, but the initial version of the HACS extension is working and available at GitHub - sander110419/Fluvius-home-assistant: Home assistant custom integration to fetch data via Fluvius API
No longer behaving as a webscraper but natively authenticating and fetching the necessary authentication token
screenshot:
Thx a lot for your work! I just installed it. One question I cannot see an option button anywhere → After the entry is created, use the Options button in the integration card to configure
This is amazing!!
I couldn’t test it because I’m I live in Brussels,
1/ Which brings me to my first question, do you believe we could do the same with Sibelga and Ores?
2/ I noticed for companies, the registration process is a bit different, It doesn’t allow for user/password, would it still work?
This is awesome, I tested it, works
Altought I wonder how can I get the price per Kwh now…
Afaik Fluvius doesn’t provide that information so you’ll have to find another way to get that info.
Which version of Home Assistant are you running? I’m trying to get it to work on my HA 2026.2.0, but always get 0.0 values in the lifetime totals. I waited for >30 hours to see anything change but hélas. Here is what I get:
"data": {
"config": {
"ean": "xxxxxxxxxxxxxxxx",
"meter_serial": "xxxxxxxxxxxxxxx ",
"meter_type": "electricity"
},
"lifetime_totals": {
"consumption_high": 0.0,
"consumption_low": 0.0,
"injection_high": 0.0,
"injection_low": 0.0,
"consumption_total": 0.0,
"injection_total": 0.0,
"net_consumption": 0.0
},
"latest_day": {
"day_id": null,
"start": null,
"end": null,
"metrics": {}
},
"peak_measurements": [],
"store_state": {
"last_day": null
}
},
"issues": []
Also verified that the sensors report values in Developer Tools → States are the same, all 0.0 and made sure that I rebooted my HA (running on RPi4 model b), twice
. Nothing needs to be enabled in the MijnFluvius platform to allow us to access this data by any chance?
Nevermind, added the integration again and now it pulls in data fine. ![]()
Thanks @sander110419 for the great work!
Hello, i’m new to this integration.
Installation went fluent and i was able to add both my electricity and gas meter.
I want to configue the Energy dashboard but aparently this does not seem te work. In the readme i found that i need to add the “Total consumption” sensor. But this does not seem to update the graph. In the dev tools i also don’t see any refreshes of the sensor.
I seem to be stuck at the same spot. I can see that some meter readings have come in:
I know that energieID.be CAN automatically pull data from fluvius so it's frustrating to see that it's not so simple to get the same data into home assistant.
Note: this is the first integration I've tried on Home assistant, I'm very inexperienced. I may have missed something obvious?