ssenart / home-assistant-gazpar

GrDF Gazpar meter integration for Home Assistant
MIT License
43 stars 9 forks source link
consumption-data gas gazpar grdf home-assistant meter

Home Assistant GrDF Gazpar

$\text{\color{green}{!!! This library is working again. CAPTCHA has been removed !!!}}$

GrDF Gazpar integration permits to integrate in Home Assistant all your gas consumption data.

From version 1.2.0, it is compatible with Lovelace Garpar Card.

Lovelace Garpar Card

GrDF Gazpar custom component is using PyGazpar library to retrieve GrDF data.

Installation

Method 1 : HACS (recommended)

Follow the steps described below to add GrDF Gazpar integration with HACS:

  1. From HACS (Home Assistant Community Store), open the upper left menu and select Custom repositories option to add the new repo.

  2. Add the address https://github.com/ssenart/home-assistant-gazpar with the category Integration, and click ADD. The new corresponding repo appears in the repo list.

  3. Select this repo (this integration description is displayed in a window) and click on INSTALL THIS REPOSITORY button on the lower right of this window.

  4. Keep the last version and click the button INSTALL on the lower right.

  5. Do click on RELOAD button for completion! The integration is now ready. It remains the configuration.

Method 2 : Manual

Copy the gazpar directory in HA config/custom_components/gazpar directory.

Configuration

Add to your Home Assistant configuration.yaml:

sensor:
- platform: 'gazpar'
  name: 'gazpar'
  username: '***'
  password: '***'
  pce_identifier: 'xxxxxxxxx'
  tmpdir: '/tmp'
  scan_interval: '08:00:00'
  lastNDays: 365

'name' is the sensor name (only available from version 1.3.5-alpha.1). Its default value is 'gazpar'.

'lastNDays' is the number of days of data to download from GrDF (only available from version 1.3.9). Its default value is 1095 (3 years).

If you have the error:

An error occurred while loading data. Status code: 500 - {"code":500,"message":"Internal Server Error"}

...it is likely you try to get more data than available. Please reduce the lastNDays parameter accordingly (see issue #62).

Do not use special characters in your password.

Ensure that tmpdir already exists before starting HA. It is used to store the downloaded Excel files from GrDF.

If using multiple accounts, you can specify them with the following syntax:

sensor:
- platform: 'gazpar'
  name: 'mygazpar'
  username: '***'
  password: '***'
  pce_identifier: 'xxxxxxxxx'
  tmpdir: '/tmp'
  scan_interval: '08:00:00'

- platform: 'gazpar'
  name: 'othergazpar'
  username: '***'
  password: '***'
  pce_identifier: 'xxxxxxxxx'
  tmpdir: '/tmp'
  scan_interval: '08:00:00'  

Restart your HA application. In HA development panel, you should see the new Gazpar entity 'sensor.gazpar' with its corresponding attributes:

weekly:

monthly:

yearly:

...


## Home Assistant Energy module integration

You probably want to integrate GrDF data into the Home Assistant Energy module.

![Dashboard](images/energy_module.png)

In Home Assistant energy configuration panel, you can set directly the sensor 'sensor.gazpar' in the gas consumption section.

I prefer using an alias for all my sensors so I keep control on the sensor naming. For that, I define a template and use the template sensor.gas_energy to configure the dashboard.

```yaml
- sensor:
  - name: gas_energy
    unit_of_measurement: 'kWh'      
    state: >
      {{ states('sensor.gazpar') }}
    icon: mdi:fire
    device_class: energy
    state_class: total_increasing

For those who prefer to use the volume data instead of the energy (kWh) data, the following template can also be used:

- sensor:
  - name: gas_volume
    unit_of_measurement: 'm³'
    state: >
      {{ state_attr('sensor.gazpar', 'daily')[0]['start_index_m3'] + state_attr('sensor.gazpar', 'daily')[0]['volume_
m3']}}
    icon: mdi:fire
    device_class: gas
    state_class: total_increasing