Skip to main content

Retrieve gas consumption from GrDF web site (French Gas Company)

Project description

PyGazpar

PyGazpar is a Python library for getting natural gas consumption from GrDF French provider.

Their natural gas meter is called Gazpar. It is wireless and transmit the gas consumption once per day.

All consumption data is available on the client account at GrDF Web Site (https://monespace.grdf.fr).

PyGazpar automatically go through the Web Site and download the consumption data Excel file, and make it available in a Python structure (list of dictionaries).

Installation

Requirements

PyGazpar is working with Selenium Python library to automate navigation through GrDF Web site. Selenium requires a WebDriver that acts as gateway between automatic actions from PyGazpar and a native browser already installed on the system.

PyGazpar 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

PyGazpar installation

Use the package manager pip to install PyGazpar.

pip install pygazpar

You can also download the source code and install it manually.

cd /path/to/pygazpar/
python setup.py install

Usage

Command line

$ pygazpar -u 'your login' -p 'your password' -w 'path/to/Selenium Web Driver' -s 30 -t 'temporary directory where to store XSLX file (ex: /tmp)'

Library

import pygazpar

client = pygazpar.Client('your login',
                         'your password',
                         'path/to/Selenium Web Driver',
                         30,
                         'temporary directory where to store XSLX file (ex: /tmp)')

client.update()

data = client.data()

Output

data =>
[
  {
    "date": "01/07/2019",
    "start_index_m3": 9802.0,
    "end_index_m3": 9805.0,
    "volume_m3": 3.6,
    "energy_kwh": 40.0,
    "converter_factor": "11,244",
    "local_temperature": "",
    "type": "MES",
    "timestamp": "2019-08-29T16:56:07.380422"
  },
  {
    "date": "02/07/2019",
    "start_index_m3": 9805.0,
    "end_index_m3": 9808.0,
    "volume_m3": 2.8,
    "energy_kwh": 31.0,
    "converter_factor": "11,244",
    "local_temperature": "21",
    "type": "MES",
    "timestamp": "2019-08-29T16:56:07.380422"
  },
  {
    "date": "03/07/2019",
    "start_index_m3": 9808.0,
    "end_index_m3": 9811.0,
    "volume_m3": 2.9,
    "energy_kwh": 33.0,
    "converter_factor": "11,244",
    "local_temperature": "",
    "type": "MES",
    "timestamp": "2019-08-29T16:56:07.380422"
  }
]

Limitation

PyGazpar relies on how GrDF 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 GrDF 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

MIT

Project status

PyGazpar has been initiated for integration with Home Assistant. This integration work is still on-going.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygazpar-0.1.11.tar.gz (6.3 kB view hashes)

Uploaded Source

Built Distribution

pygazpar-0.1.11-py3-none-any.whl (8.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page