Retrieve water consumption from Veolia Ile-de-France web site (French Water Company)
Project description
PyVeoliaIDF
PyVeoliaIDF is a Python library for getting water consumption from Veolia French provider.
Their water meter are wireless and transmit the consumption once per day.
All consumption data is available on the client account at Veolia Web Site (https://espace-client.vedif.eau.veolia.fr).
PyVeoliaIDF automatically go through the Web Site and download the consumption data CSV file, and make it available in a Python structure (list of dictionaries).
Installation
Requirements
PyVeoliaIDF is working with Selenium Python library to automate navigation through Veolia Web site. Selenium requires a WebDriver that acts as gateway between automatic actions from PyVeoliaIDF and a native browser already installed on the system.
PyVeoliaIDF has been developped and tested with Firefox browser (version 68.8) and its corresponding Web Driver geckodriver (version 0.24).
Firefox browser installation
Follow instructions here
Firefox Web Driver (geckodriver) installation
Follow instructions here
Create your virtual environment
$ pip install virtualenv
$ cd /path/to/my_project_folder/
$ virtualenv venv
PyVeoliaIDF installation
Use the package manager pip to install PyVeoliaIDF.
pip install pyveoliaidf
You can also download the source code and install it manually.
cd /path/to/pyveoliaidf/
python setup.py install
Usage
Command line
$ pyveoliaidf -u 'your login' -p 'your password' -w 'path/to/Selenium Web Driver' -s 30 -t 'temporary directory where to store CSV file (ex: /tmp)'
Library
import pyveoliaidf
client = pyveoliaidf.Client('your login',
'your password',
365,
'path/to/Selenium Web Driver',
30,
'temporary directory where to store CSV file (ex: /tmp)')
client.update()
data = client.data()
Output
data =>
[
{
"time": "2019-07-14 19:00:00",
"total_liter": "506669",
"daily_liter": "530",
"type": "Estim\u00c3\u00a9",
"timestamp": "2019-08-31T16:55:01.236779"
},
{
"time": "2019-07-15 19:00:00",
"total_liter": "507523",
"daily_liter": "854",
"type": "Mesur\u00c3\u00a9",
"timestamp": "2019-08-31T16:55:01.236779"
},
{
"time": "2019-07-16 19:00:00",
"total_liter": "508314",
"daily_liter": "791",
"type": "Mesur\u00c3\u00a9",
"timestamp": "2019-08-31T16:55:01.236779"
}
]
Limitation
PyVeoliaIDF relies on how Veolia Web Site is built. It goes through each Web pages and automatically fill forms, click buttons using their internal identifiers.
Any change in the Web site structure or identifier naming may break this library.
We expect in close Future that Veolia makes available a standard API from which we can get safely their data.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Project status
PyVeoliaIDF has been initiated for integration with Home Assistant.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[0.3.1] - 2024-01-27
Fixed
- Fix lint error: W291 trailing whitespace
[0.3.0] - 2024-01-27
Fixed
- The Web site has changed some component xpath.
Changed
- Upgrade Selenium version to 4.17.2
- Upgrade Geckodriver version to 0.34.0
[0.2.1] - 2023-02-05
Fixed
- The Web site has changed some component xpath.
[0.2.0] - 2022-10-17
Added
- Add a new parameter 'lastNDays' that permits to control how many days of data we want to retrieve.
Fixed
- Add some means that permits to log every Selenium actions.
- Add some controls on the downloaded data file (check its content) before processing it.
[0.1.13] - 2021-12-03
Fixed
- Increase waiting time after selection of 'Jours' and 'Litres' buttons. Sometimes, we get only a partial set of data with missing most recent ones.
0.1.12 - 2020-10-12
Fixed
- The Veolia login email text box has changed its identifier.
0.1.11 - 2020-10-03
Fixed
- After simulating clicks on the 'Jours' and 'Litres' buttons, we have to wait a few (5 seconds) for internal form refresh. Otherwise, we got an inconsistent data file.
0.1.10 - 2020-10-03
Fixed
- The VeoliaIDF web site has changed and added some buttons to select the consumption period and the consumption unit.
0.1.9 - 2019-08-31
Fixed
- WebDriver window size must be large enough to display all clickable components.
0.1.8 - 2019-08-31
Added
- Use PropertyNameEnum type to store all property names.
- Add LoginError exception raised when PyVeoliaIDF is unable to sign in the Veolia Web site with the given username/password.
- Add timestamp property that contains date/time when the data has been retrieved.
MIT License
Copyright (c) 2019 Stéphane Senart
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file pyveoliaidf-0.3.1.tar.gz
.
File metadata
- Download URL: pyveoliaidf-0.3.1.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4dcd6f957bfc3d83d86c62b1dd36170383caec40a50553579735b79f6f44825 |
|
MD5 | a4c13f2cf4c7be73c7a1b2c8ef629ca1 |
|
BLAKE2b-256 | b21edd589ad4f77c368a92f4fd87284e3c3f4bcc205b8132f3d9d11fd2d7d7ca |
File details
Details for the file pyveoliaidf-0.3.1-py310-none-any.whl
.
File metadata
- Download URL: pyveoliaidf-0.3.1-py310-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3ee2a21cfd3d474714c59fc5d5b61df2ce589f99a7ad211f8bdd5bf443bb74b |
|
MD5 | feb6a3a78ddea88c5489bd4404f0a0cc |
|
BLAKE2b-256 | 36bdf1717775249fa6958ab8cc79c7b114e8a556ade587a4e5b2adde118ab265 |
File details
Details for the file pyveoliaidf-0.3.1-py39-none-any.whl
.
File metadata
- Download URL: pyveoliaidf-0.3.1-py39-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07f1a51e4f75425b8e3c7fe3f0709504f00065c8b8831f0a7733a94c1ad084bc |
|
MD5 | e62ef25132520b1f251195804eab7190 |
|
BLAKE2b-256 | 1e5c66e5aa78bcc0572acfe3aaac50cd741f9ab9b52fa47d2dbac36db5647550 |