Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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 goes through the Web Site and download the consumption data, and make it available in a Python structure.

Installation

Requirements

PyGazpar does not require Selenium and corresponding geckodriver to work.

With the new GrDF web site, it is possible to load the consumption data far easily than before.

PyGazpar uses Poetry for dependency and package management.

Create your virtual environment

$ cd /path/to/my_project_folder/

$ poetry install

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/

$ poetry install

Usage

Command line:

  1. Standard usage (using Json GrDF API).
$ pygazpar -u 'your login' -p 'your password' -c 'your PCE identifier' --datasource 'json'
  1. Alternate usage (using Excel GrDF document).
$ pygazpar -u 'your login' -p 'your password' -c 'your PCE identifier' -t 'temporary directory where to store Excel file (ex: /tmp)' --datasource 'excel'
  1. Test usage (using local static data files, do not connect to GrDF site).
$ pygazpar -u 'your login' -p 'your password' -c 'your PCE identifier' --datasource 'test'

Library:

  1. Standard usage (using Json GrDF API).
import pygazpar

client = pygazpar.Client(pygazpar.JsonWebDataSource(
    username='your login',
    password='your password')
)

# Returns the list of your PCE identifiers attached to your account.
pce_identifiers = client.get_pce_identifiers()

# Returns the daily and monthly consumptions for the last 60 days on your PCE identifier.
data = client.load_since(pce_identifier='your PCE identifier',
                        last_n_days=60,
                        frequencies=[pygazpar.Frequency.DAILY, pygazpar.Frequency.MONTHLY])

See samples/jsonSample.py file for the full example.

  1. Alternate usage (using Excel GrDF document).
import pygazpar

client = pygazpar.Client(pygazpar.ExcelWebDataSource(
    username='your login',
    password='your password')
)

# Returns the list of your PCE identifiers attached to your account.
pce_identifiers = client.get_pce_identifiers()

# Returns the daily and monthly consumptions for the last 60 days on your PCE identifier.
data = client.load_since(pce_identifier='your PCE identifier',
                        last_n_days=60,
                        frequencies=[pygazpar.Frequency.DAILY, pygazpar.Frequency.MONTHLY])

See samples/excelSample.py file for the full example.

  1. Test usage (using local static data files, do not connect to GrDF site).
import pygazpar

client = pygazpar.Client(pygazpar.TestDataSource())

data = client.load_since(pce_identifier='your PCE identifier',
                        last_n_days=10,
                        frequencies=[pygazpar.Frequency.DAILY, Frequency.MONTHLY])

See samples/testSample.py file for the full example.

Output:

data =>
{
  "daily": [
    {
      "time_period": "13/10/2022",
      "start_index_m3": 15724,
      "end_index_m3": 15725,
      "volume_m3": 2,
      "energy_kwh": 17,
      "converter_factor_kwh/m3": 11.16,
      "temperature_degC": null,
      "type": "Mesur\u00e9",
      "timestamp": "2022-12-13T23:58:35.606763"
    },
    ...
    {
      "time_period": "11/12/2022",
      "start_index_m3": 16081,
      "end_index_m3": 16098,
      "volume_m3": 18,
      "energy_kwh": 201,
      "converter_factor_kwh/m3": 11.27,
      "temperature_degC": -1.47,
      "type": "Mesur\u00e9",
      "timestamp": "2022-12-13T23:58:35.606763"
    }
  ],
  "monthly": [
    {
      "time_period": "Novembre 2022",
      "start_index_m3": 15750,
      "end_index_m3": 15950,
      "volume_m3": 204,
      "energy_kwh": 2227,
      "timestamp": "2022-12-13T23:58:35.606763"
    },
    {
      "time_period": "D\u00e9cembre 2022",
      "start_index_m3": 15950,
      "end_index_m3": 16098,
      "volume_m3": 148,
      "energy_kwh": 1664,
      "timestamp": "2022-12-13T23:58:35.606763"
    }
  ]
}

Limitation

PyGazpar relies on how GrDF Web Site is built.

Any change in the Web site may break this library.

We expect in close Future that GrDF makes available an open 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.

Corresponding Home Assistant integration custom component is available here.

Download files

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

Source Distribution

pygazpar-1.4.0a1.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygazpar-1.4.0a1-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file pygazpar-1.4.0a1.tar.gz.

File metadata

  • Download URL: pygazpar-1.4.0a1.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pygazpar-1.4.0a1.tar.gz
Algorithm Hash digest
SHA256 b0bebdebf6f1240437c3e6f1d1359c0377c5ff6d090865d42e017fc2c247056e
MD5 14c6d4c588d82309e52b087b0697c792
BLAKE2b-256 095c604d7baeae297bfb205daac807f5f40f6527609dd90681f787645dc00fd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygazpar-1.4.0a1.tar.gz:

Publisher: create-release.yaml on ssenart/PyGazpar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygazpar-1.4.0a1-py3-none-any.whl.

File metadata

  • Download URL: pygazpar-1.4.0a1-py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pygazpar-1.4.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 1434618cead08ef2c0dbb3c17cb2d8ee7c4f4d07d1f0e748ae234f101a730706
MD5 99649a240ee6c68d4c04f655fdb89345
BLAKE2b-256 1d19d5e6c3c6684bc1df1e4a9a734d64fd777541e3404e4f8a3a05838c602997

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygazpar-1.4.0a1-py3-none-any.whl:

Publisher: create-release.yaml on ssenart/PyGazpar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.4.0a1 This release

2 files

1.3.1

2 files

1.3.0

2 files

1.2.8

6 files

1.2.7

7 files

1.2.6

7 files

1.2.5

7 files

1.2.4

7 files

1.2.3

2 files

1.2.2

6 files

1.2.0

6 files

1.1.7

6 files

1.1.6

6 files

1.1.5

5 files

1.1.4

5 files

1.1.2

5 files

1.1.1

5 files

1.0.2

5 files

1.0.1

5 files

0.2.0

5 files

0.1.27

5 files

0.1.26

5 files

0.1.25

5 files

0.1.24

5 files

0.1.23

5 files

0.1.22.7

5 files

0.1.22.6

2 files

0.1.22.5

2 files

0.1.22.4

2 files

0.1.22.3

2 files

0.1.22.post8

5 files

0.1.21

2 files

0.1.20

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

1 file

0.1.8

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page