Open jcisio opened 3 years ago
I've just found another library that uses webdriver to click on the "Download" button to get the CSV version https://github.com/Flobul/conso_veolia/blob/master/get_veolia_idf_consommation.py
Hi,
Thank you for your interest. Manage all the Veolia entrypoints within the same library sound good.
I'm not a big fan using webdriver to trigger the request. It's better to reproduce the final request like the POST one you described.
On your Veolia version, do you have a page where you can see your consumption like this :
What's the delay to get your daily consumption?
The UI is completely different. I can get consumption in euros, m3 or litters. There is no delay, this morning I got yesterday consumption.
So I think I'll look into it in the next few days and will try to submit a PR.
Well, it's harder than I thought. Veolia IDF build they website using Salesforce with a JS framework (Aurora) with many states. It would require effort to reverse engineer the JS framework. I'm looking around and it seems all attempts are based on a webdriver. Besides the above links, other examples:
After another round playing around, try to get the essential data, it's quite complex. Here are the post data to get the mesures (it won't work as-is because I remove the cookies part):
message={"actions":[{"id":"335;a","descriptor":"aura://ApexActionController/ACTION$execute","callingDescriptor":"UNKNOWN","params":{"namespace":"","classname":"LTN015_ICL_ContratConsoHisto","method":"getData","params":{"contractId":"4VhoQjJVQMHyZOV9Y2k9WMJaAg7KXnfBjNIWZBPX57ieLhgPERHbEy9zWajeNsI0","TYPE_PAS":"JOURNEE","DATE_DEBUT":"2021-02-02","DATE_FIN":"2021-02-16","NUMERO_COMPTEUR":"crb8b9r0YvC%2BYqg5H8CvcTaqej4mjA3Gi1PeqhiCtJDIcBsLyG4mcgliBpU4rORl","ID_PDS":"lJqG66BlO5A1jIugBnI%2B9LtqvoXmyI8ED8ms78tOKDQ%3D"},"cacheable":false,"isContinuation":false}}]}&aura.context={"mode":"PROD","fwuid":"8WYDoRiNKzw4em08r-Gg4A","app":"siteforce:communityApp","loaded":{"APPLICATION@markup://siteforce:communityApp":"fV3Zo7mI3PLrr1VMsCPF3w","COMPONENT@markup://forceCommunity:embeddedServiceSidebar":"G-AEnzq63TIgJNF3Aq3-Xw"},"dn":[],"globals":{},"uad":false}&
aura.pageURI=/s/historique&
aura.token=eyJub25jZSI6InF4Q1g3dzM0UENnSW5ySFkzcHRSVFBTWXRJQkhiUWJNMEFHT0xJanNfVkVcdTAwM2QiLCJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6IntcInRcIjpcIjAwRDBZMDAwMDAzQndnc1wiLFwidlwiOlwiMDJHMFkwMDAwMDBoMXJPXCIsXCJhXCI6XCJjYWltYW5zaWduZXJcIn0iLCJjcml0IjpbImlhdCJdLCJpYXQiOjE2MTM0MjA5MDQ3MDYsImV4cCI6MH0=..ubavIisGutVchOTsNeyAzpKekhUPvISKgojwF6yyFIc=
Another link https://forum.jeedom.com/viewtopic.php?f=140&t=21200&start=680#p747026 so even with curl to reproduct the request, it won't work after a week.
It’s just a matter of token. To be checked if the value is stored within a cookie for instance. Once the location of this value found, we have to know which request create this resource. Most of the time, it’s the login step.
I think there is also some random value generated at the beginning. I haven't had time yet to reinvestigate the problem. If you want I think I could give you temporary access to my account to check the login / consumption data.
@jcisio Are you on the HA discord or on Reddit? We will need a place where to share the credentials ;)
Bonjour, I'm also interested in having this wonderful client available for Veolia IDF website. I'm targetting to integrate the data in Home Assistant afterwards. Where did you investigations ended previously ? Did you manage to avoid using Selenium to fetch the data ?
@pafnow unfortunately, nowhere :( The workflow to get the resource request is too complex. The JS framework used is not grokkabke. And Veolia support said that they didn't have any plan to make an API availble.
Thanks for the answer, sadly, it was predictable... Well I'll put this on hold until i'm resigned to use Selenium
Hi, I'm also interested in the integration of IDF.
Hi, maybe you could have a look at : https://github.com/s0nik42/veolia-idf ... It works with domoticz in my home on a raspberry pi3 + raspbian
Hi, maybe you could have a look at : https://github.com/s0nik42/veolia-idf ...
It works with domoticz in my home on a raspberry pi3 + raspbian
This lib uses selenium and webscraping is not allowed by Home assistant. There was too many issues with such library.
OK, I understand that but https://github.com/s0nik42/veolia-idf is basically a crontab job which could write the result in a file. Is there a way to send this file content to a Home Assistant entity or device ? (I am not fluent in HA API ...)
@llo94 yes it uses a webdriver, like other library to work with Veolia IDF. We tried to avoid using webdriver, but only API or something like that, but it seems that we are out of luck.
A workaround could be that library to generate a CSV file in a HTTP accessible place, then we parse it from HA.
Hi guys, Any chance that something move ahead on this Veolia IDF topic during the last 2 years ? It would be great seeing this happening :) Thanks a lot
Hi,
Are you willing to add/maintain Veolia IDF (https://espace-client.vedif.eau.veolia.fr/) version? They share the name Veolia but the website is not the same, the account is not shared, the contract number is different etc. And data are returned in JSON format, with a POST request. In summary, they share nothing except the name.
However, the actual client is small. So I don't know what do you want to proceed. If you are willing to maintain, I think I could submit a PR.
The purpose of this request is to be possibile to use the Veolia integration in HA without forking everything.