GithubHelp home page GithubHelp logo

yukulehe / gazpar2mqtt Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 9.0 1.9 MB

Python script to fetch GRDF's website data and publish data to a mqtt broker.

License: GNU General Public License v3.0

Dockerfile 0.56% Python 99.44%
gazpar grdf mqtt homeassistant home-automation home-assistant gas-sensor gas

gazpar2mqtt's Introduction

IMPORTANT NOTE

THIS APPLICATION IS OUT OF SERVICE SINCE THE ACTIVATION OF CAPTCHA ON GRDF WEBSITE

gazpar2mqtt

Python script to fetch GRDF's website data and publish data to a mqtt broker

Gazpar logo

Externals/Thanks

The project has been inspired by job done by empierre on project domoticz_gazpar and beufanet on project gazinflux availables on Github. I modified a bit the code to work and fit my needs. Thanks to echauvet for his big contribution on GRDF API and the calculation of new sensors.

Informations

Important : the tool is still under development, various functions may disappear or be modified.

Changelogs :

  • v0.8.x :

    • Export to Influxdb v2 database
    • Grafana dashboard template
    • Cost calculation from prices file
    • Thanks to pbranly for the tests
  • v0.7.x :

    • Retrieve published measures to supplier
  • v0.6.x :

    • Implementation of a sqlite database
    • Addition of converter factor from Grdf
    • Calculation of aggregated consumptions for calendar periods (year, month, week and day) and rolling periods (1 year, 1 month, 1 week)
    • Retrieve of GRDF's thresold and warn when a thresold is reached
    • Exponential wait between retries when the application failed to connect to GRDF website
    • Database path editable as parameter
  • v0.5.x :

    • Hard redesign of the application after new GRDF website released on 23/11/2021 . Thanks to echauvet for his contribution.
    • Published values are now PCE dependent
    • Add last index
    • Home assistant : Add entity last index which can be integrated in Hass Energy panel
    • Rework of python code
    • Add Debug mode in environment variable
    • Add connexion retries to GRDF when it failed
  • v0.4.x :

  • v0.3.x :

    • First reliable release

Roadmap :

  • Home assistant custom entity card

Requirements

Python3 and libs

python3 with its dependencies:

pip3 install -r app/requirement.txt

GRDF Gazpar API

Verify you have gazpar data available on GRDF Portal Remember, kWh provided is conversion factor dependant. Please verify it's coherent with your provider bills.

Gazpar2mqtt request the API and retrieve 4 groups of data :

Account informations

It corresponds to the customer profile, the list of PCE (Point de Comptage et d'Estimation) and its attributes (address, state, activation date)

Informative measures

GRDF provides informative measures at day level. The tool returns the last measure and several calculated indicators.

Published measures

GRDF provides published measures. It corresponds to consumptions measured by GRDF and transmitted to your gas supplier. Consequently, it should correspond to the consumption that the supplier invoices to the consumer.

Thresolds

Thresolds (Seuil) can be set on GRDF website for current and future months. image image

The script can retrieve those informations and publish a warn when the thresold is close to being reached.

Prices

Gazpar2mqtt can ingest your own energy prices to estimate your costs. Download and complete the sample file prices.csv using the following format :

  • PCE : your PCE id
  • startDate : starting date of the price
  • endDate : end date of the price (put a far far end date at the last row of the file, ie : 2999-12-31)
  • kwhPrice : the price per kWh (don't forget to apply the TVA to this cost, and to add the french energy tax per kwh)
  • fixPrice : the fix price per day (it corresponds for example to the price of your subscription with your gas provider, don't forget to apply the TVA)
pce;startDate;endDate;kwhPrice;fixPrice
XXXX;2019-11-28;2020-12-27;0.03713;0.25
XXXX;2020-12-28;2021-01-25;0.03472;0.30
XXXX;2021-01-26;2099-12-31;0.03733;0.35

Then precise in parameters the path to the file prices.csv.

MQTT broker

A MQTT broker is required. Please check its configuration (hostname, port, remote access allowed, username & password if needed).

Parameters

Currently, parameters can be provided by command's arguments or by the OS's environment variables.

Mandatory :

Variable Description
GRDF_USERNAME Your GRDF login (ex : [email protected])
GRDF_PASSWORD Your GRDF password
MQTT_HOST Hostname or ip adress of the MQTT broker

Optional :

Variable Description Default value
SCHEDULE_TIME Time for refreshing data everyday None (format : 14:30)
MQTT_PORT Port of the MQTT broker 1883
MQTT_TOPIC Topic used as prefix gazpar
MQTT_CLIENTID Client id to be used for connexion to the MQTT broker gazou
MQTT_USERNAME Username to be used for connexion to the MQTT brokerr
MQTT_PASSWORD Password to be used for connexion to the MQTT broker
MQTT_QOS QOS for message publishing (0, 1 or 2) 1
MQTT_RETAIN Retain flag False
MQTT_SSL Enable MQTT SSL connexion False
STANDALONE_MODE Enable standalone publication mode True
HASS_DISCOVERY Enable Home assistant dicovery mode False
HASS_PREFIX Home assistant topic prefix homeassistant
HASS_DEVICE_NAME Home assistant device name gazpar
THRESOLD_PERCENTAGE Percentage of the thresold to be reached 80
PRICE_PATH Path to price.csv file /data
PRICE_KWH_DEFAULT Energy price in € per kWh 0.04
PRICE_FIX_DEFAULT Fix price in € per day 0.0
INFLUXDB_ENABLE Activate export to Influxdb v2 False
INFLUXDB_HOST Host of influxdb
INFLUXDB_PORT Port of influxdb 8086
INFLUXDB_ORG Influxdb organization
INFLUXDB_BUCKET Influxdb bucket
INFLUXDB_TOKEN Influxdb token with read access to the bucket
INFLUXDB_HORIZON Number of days in the past to be write to Influxdb 0 (= all data)
DB_INIT Force reinitialization of the database False
DB_PATH Database path /data
DEBUG Enable debug mode False

Usage

Running script

Run it manually :

python3 app/gazpar2mqtt.py

Run it manually with a selection of arguments overwritting parameters :

python3 app/gazpar2mqtt.py [email protected] --grdf_password=mypassword --mqtt_host=myhost --mqtt_clientId=gazou --mqtt_retain=True

Schedule it manually :

python3 app/gazpar2mqtt.py --schedule 10:30

Full list of arguments :

python3 app/gazpar2mqtt.py --help

Docker

docker_logo

Have a look the docker repository.

Example of docker run command with some environment variables :

docker run --name app/gazpar2mqtt -e [email protected] -e GRDF_PASSWORD=password -e MQTT_HOST=192.168.1.99 -e MQTT_PORT=1883 -e MQTT_CLIENTID=gazou -e MQTT_QOS=1 -e MQTT_TOPIC=gazpar -e MQTT_RETAIN=False --tty yukulehe/gazpar2mqtt:latest

Standalone mode

Default mode, gazpar2mqtt is autonomous and is not dependent of any third-party tool. You can replace the default topic prefix gazpar (see mqtt broker requirements chapter)

Measures :

Last measures :

Topic Description
gazpar/PCE/last/index Gas index in m3 of the last measure
gazpar/PCE/last/date Date of the last measure
gazpar/PCE/last/energy Gas consumption in kWh of the last measure
gazpar/PCE/last/gas Gas consumption in m3 of the last measure
gazpar/PCE/last/conversion_factor Conversion factor in kWh/m3 of the last measure

Published measures :

Topic Description
gazpar/PCE/published/index Gas index in m3 of the last published measure
gazpar/PCE/published/start_date Start date of the period of the last published measure
gazpar/PCE/published/end_date End date of the period of the last published measure
gazpar/PCE/published/energy Gas consumption in kWh of the last published measure
gazpar/PCE/published/gas Gas consumption in m3 of the last published measure
gazpar/PCE/published/conversion_factor Conversion factor in kWh/m3 of the last published measure

Calculated calendar measures :

Topic Description
gazpar/PCE/histo/current_year_gas Gas consumption in m3 of current year
gazpar/PCE/histo/previous_year_gas Gas consumption in m3 of previous year
gazpar/PCE/histo/current_month_gas Gas consumption in m3 of current month
gazpar/PCE/histo/previous_month_gas Gas consumption in m3 of previous month
gazpar/PCE/histo/current_month_previous_year_gas Gas consumption in m3 of current month, 1 year ago
gazpar/PCE/histo/current_week_gas Gas consumption in m3 of current week
gazpar/PCE/histo/previous_week_gas Gas consumption in m3 of previous week
gazpar/PCE/histo/current_week_previous_year Gas consumption in m3 of current week, 1 year ago
gazpar/PCE/histo/day-1_gas Gas consumption in m3, 1 day ago
gazpar/PCE/histo/day-2_gas Gas consumption in m3, 2 day ago
gazpar/PCE/histo/day-3_gas Gas consumption in m3, 3 day ago
gazpar/PCE/histo/day-4_gas Gas consumption in m3, 4 day ago
gazpar/PCE/histo/day-5_gas Gas consumption in m3, 5 day ago
gazpar/PCE/histo/day-6_gas Gas consumption in m3, 6 day ago
gazpar/PCE/histo/day-7_gas Gas consumption in m3, 7 day ago

Calculated rolling measures :

Topic Description
gazpar/PCE/histo/rolling_year_gas Gas consumption in m3 for 1 rolling year
gazpar/PCE/histo/rolling_year_last_year_gas Gas consumption in m3 for 1 rolling year, 1 year ago
gazpar/PCE/histo/rolling_month_gas Gas consumption in m3 for 1 rolling month
gazpar/PCE/histo/rolling_month_last_month_gas Gas consumption in m3 for 1 rolling month, 1 month ago
gazpar/PCE/histo/rolling_month_last_year_gas Gas consumption in m3 for 1 rolling month, 1 year ago
gazpar/PCE/histo/rolling_month_last_2_year_gas Gas consumption in m3 for 1 rolling month, 2 years ago
gazpar/PCE/histo/rolling_week_gas Gas consumption in m3 for 1 rolling week
gazpar/PCE/histo/rolling_week_last_week_gas Gas consumption in m3 for 1 rolling week, 1 week ago
gazpar/PCE/histo/rolling_week_last_year_gas Gas consumption in m3 for 1 rolling week, 1 year ago
gazpar/PCE/histo/rolling_week_last_2_year_gas Gas consumption in m3 for 1 rolling week, 2 years ago

Calculated thresold measures :

Topic Description
gazpar/PCE/thresold/current_month_thresold Thresold in kWh of current month
gazpar/PCE/thresold/current_month_thresold_percentage Percentage of energy consumption and thresold of current month
gazpar/PCE/thresold/current_month_thresold_problem Warning when energy consumption is higher than 80% of the thresold of current month
gazpar/PCE/thresold/previous_month_thresold Thresold in kWh of previous month
gazpar/PCE/thresold/previous_month_thresold_percentage Percentage of energy consumption and thresold of previous month
gazpar/PCE/thresold/previous_month_thresold_problem Warning when energy consumption is higher than 80% of the thresold of previous month

Note : thresold percentage can be editable in environment variable

Status :

Topic Description
gazpar/PCE/status/date Last execution date time of gazpar2mqtt
gazpar/PCE/status/value Last execution status of gazpar2mqtt (ON or OFF)

Home Assistant discovery mode

HA_logo

Gazpar2mqtt provides Home Assistant compatible Mqtt devices. The discovery function enable to use MQTT devices with a minimal configuration effort. Have a look to Home Assistant Mqtt discovery documentation.

Device :

Device name Device ID Model Manufacturer
gazpar gazpar_PCE PCE GRDF

Note : you can replace the default device name gazpar by editing the related parameter.

List of entities :

Last informative measure entities :

Entity name Component Device class Description
gazpar_PCE_index Sensor Gas Gas index in m3 of the last measure
gazpar_PCE_gas Sensor Gas Gas consumption in m3 of the last measure
gazpar_PCE_energy Sensor Energy Gas consumption in kWh of the last measure
gazpar_PCE_consumption_date Sensor Date Date of the last measure
gazpar_PCE_connectivity Binary sensor Connectivity Binary sensor which indicates if the last gazpar statement succeeded (ON) or failed (OFF)

Last published measure entities :

Entity name Component Device class Description
gazpar_PCE_published_index Sensor Gas Gas index in m3 of the last published measure
gazpar_PCE_published_gas Sensor Gas Gas consumption in m3 of the last published measure
gazpar_PCE_published_energy Sensor Energy Gas consumption in kWh of the last published measure
gazpar_PCE_published_consumption_start_date Sensor Date Start date of the last published measure
gazpar_PCE_published_consumption_end_date Sensor Date End date of the last published measure

Calendar measure entities :

Entity name Component Device class Description
gazpar_PCE_current_year_gas Sensor Gas Gas consumption in m3 of current year
gazpar_PCE_previous_year_gas Sensor Gas Gas consumption in m3 of previous year
gazpar_PCE_previous_2_year_gas Sensor Gas Gas consumption in m3 of previous 2 years
gazpar_PCE_current_month_gas Sensor Gas Gas consumption in m3 of current month
gazpar_PCE_previous_month_gas Sensor Gas Gas consumption in m3 of previous month
gazpar_PCE_current_month_last_year_gas Sensor Gas Gas consumption in m3 of current month, 1 year ago
gazpar_PCE_current_week_gas Sensor Gas Gas consumption in m3 of current week
gazpar_PCE_previous_week_gas Sensor Gas Gas consumption in m3 of current week
gazpar_PCE_current_week_last_year_gas Sensor Gas Gas consumption in m3 of current week, 1 year ago
gazpar_PCE_current_day_1_gas Sensor Gas Gas consumption in m3 of day -1
gazpar_PCE_current_day_2_gas Sensor Gas Gas consumption in m3 of day -2
gazpar_PCE_current_day_3_gas Sensor Gas Gas consumption in m3 of day -3
gazpar_PCE_current_day_4_gas Sensor Gas Gas consumption in m3 of day -4
gazpar_PCE_current_day_5_gas Sensor Gas Gas consumption in m3 of day -5
gazpar_PCE_current_day_6_gas Sensor Gas Gas consumption in m3 of day -6
gazpar_PCE_current_day_7_gas Sensor Gas Gas consumption in m3 of day -7

Rolling measure entities :

Entity name Component Device class Description
gazpar_PCE_rolling_year_gas Sensor Gas Gas consumption in m3 for 1 rolling year
gazpar_PCE_rolling_year_last_year_gas Sensor Gas Gas consumption in m3 for 1 rolling year, 1 year ago
gazpar_PCE_rolling_rolling_month_gas Sensor Gas Gas consumption in m3 for 1 rolling month
gazpar_PCE_rolling_month_last_month_gas Sensor Gas Gas consumption in m3 for 1 rolling month, 1 month ago
gazpar_PCE_rolling_month_last_year_gas Sensor Gas Gas consumption in m3 for 1 rolling month, 1 year ago
gazpar_PCE_rolling_month_last_2_year_gas Sensor Gas Gas consumption in m3 for 1 rolling month, 2 years ago
gazpar_PCE_rolling_rolling_week_gas Sensor Gas Gas consumption in m3 for 1 rolling week
gazpar_PCE_rolling_week_last_week_gas Sensor Gas Gas consumption in m3 for 1 rolling week, 1 week ago
gazpar_PCE_rolling_week_last_year_gas Sensor Gas Gas consumption in m3 for 1 rolling week, 1 year ago
gazpar_PCE_rolling_week_last_2_year_gas Sensor Gas Gas consumption in m3 for 1 rolling week, 2 years ago

Calculated thresold measures :

Entity name Component Device class Description
gazpar_PCE_current_month_thresold Sensor Energy Thresold in kWh of current month
gazpar_PCE_current_month_thresold Sensor None Percentage of energy consumption and thresold of current month
gazpar_PCE_current_month_thresold Binary sensor Problem Warning when energy consumption is higher than 80% of the thresold of current month
gazpar_PCE_previous_month_thresold Sensor Energy Thresold in kWh of previous month
gazpar_PCE_previous_month_thresold Sensor None Percentage of energy consumption and thresold of previous month
gazpar_PCE_previous_month_thresold Binary sensor Problem Warning when energy consumption is higher than 80% of the thresold of previous month

Note : thresold percentage can be editable in environment variable.

Add-on

For Hass.io users, gazpar2mqtt is also available as an add-on provided by alexbelgium (thanks you to him). Please visit the dedicated repository.

InfluxDb & Grafana

You can activate export of data to your InfluxDb v2 database. InfluxDb v1 is currently not supported.

Example of a Grafana dashboard using InfluxDb v2 and gazpar2mqtt measures :

To integrate this dashboard into Grafana, copy/paste content of file grafana_sample.json.

gazpar2mqtt's People

Contributors

alexbelgium avatar infopromt avatar yukulehe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gazpar2mqtt's Issues

Unable to login to GRDF website

Bonjour,

Je rencontre régulièrement des problèmes de connexion au site GRDF, bien que les identifiants soient corrects.
Comment puis-je investiguer sur ce souci ?

gazpar2mqtt | 2021-12-21 08:56:51,740 INFO ----------------------------------------------------------- gazpar2mqtt | 2021-12-21 08:56:51,741 INFO # Get data from GRDF website # gazpar2mqtt | 2021-12-21 08:56:51,742 INFO ----------------------------------------------------------- gazpar2mqtt | 2021-12-21 08:56:51,743 INFO Connexion to GRDF, try 1/14... gazpar2mqtt | 2021-12-21 08:57:01,787 INFO Unable to login to GRDF website gazpar2mqtt | 2021-12-21 08:57:01,788 INFO Wait 20 seconds (0 min) before next try gazpar2mqtt | 2021-12-21 08:57:21,801 INFO Connexion to GRDF, try 2/14... gazpar2mqtt | 2021-12-21 08:57:31,833 INFO Unable to login to GRDF website gazpar2mqtt | 2021-12-21 08:57:31,833 INFO Wait 113 seconds (2 min) before next try

Installation

Bonjour,
désole pour mon ignorance mais je débute dans HA
Je souhaite recuperer les informations de GARPAR2 MQTT pour les inserer dans la partie energie
j'ai donc installer l'addon, configurer mon mot de passe ainsi que l'identifiant et lancer la connexion.
tout a l'air de fonctionner, le log me dit qul a recuperer des informations mais je ne sais pas comment creer des entités par rapport a ces informations
pourriez vous m'aider

cordialement

Error on boolean parameters

J'ai eu un petit soucis dans la conf entre true et True.
Seul True avec la majuscule est compris. true tout en minuscule équivaut a False ici.
Si y a moyen de remonter une erreur de conf ou de comprendre les 2 cas ça peut être bien.

Originally posted by @Minims in #11 (comment)

incorrect device class gas

Which addon?

  • Addon name : gazpar2mqtt
  • Addon version : 0.8.2

Describe the bug
un facteur de conversion ne peux pas avoir de device class gas
le log récurrent

2022-08-29 18:15:10.089 WARNING (Recorder) [homeassistant.components.sensor.recorder] sensor.gazpar_maison_conversion_factor has unit kWh/m³ which is unsupported for device_class gas
2022-08-29 18:15:10.093 WARNING (Recorder) [homeassistant.components.sensor.recorder] sensor.gazpar_maison_published_conversion_factor has unit kWh/m³ **which is unsupported for device_class gas**

InfluxDB

Hello,

Did you plan to add influxDB support for long term storage ?

Regards,

Edouard

Get Measurements error

Hello !

I semble qu'il y ai encore un petit souci de recuperation des données :)
Comment peu t on aider ?

2021-12-06 08:10:46,984 1 PCE found !
2021-12-06 08:10:46,986 Get measures of PCE xxx alias xxx
2021-12-06 08:10:46,986 Range period : from 2021-11-29 to 2021-12-05...
2021-12-06 08:10:47,050 https://monespace.grdf.fr:443 "GET /api/e-conso/pce/consommation/informatives?dateDebut=2021-11-29&dateFin=2021-12-05&pceList%5B%5D=xxx HTTP/1.1" 200 None
Traceback (most recent call last):
  File "/app/gazpar2mqtt.py", line 353, in <module>
    run(myParams)
  File "/app/gazpar2mqtt.py", line 146, in run
    myGrdf.getPceDailyMeasures(pce,startDate,endDate)
  File "/app/gazpar.py", line 177, in getPceDailyMeasures
    for measure in measureList[pce.pceId]["releves"]:
TypeError: list indices must be integers or slices, not str
The app has crashed. Are you sure you entered the correct config options?

Whoami unsuccessfu

2021-12-16 12:14:26,867 INFO # Get data from GRDF website #

2021-12-16 12:14:26,867 INFO -----------------------------------------------------------

2021-12-16 12:14:26,867 INFO Connexion to GRDF, try 1/14...

2021-12-16 12:14:28,180 INFO GRDF connected !

2021-12-16 12:14:28,180 INFO Retrieve account informations

2021-12-16 12:14:28,264 INFO <Response [500]>

2021-12-16 12:14:28,265 INFO Whoami unsuccessful. Invalid returned information: {"code":500,"message":"Internal Server Error"}

Traceback (most recent call last):

File "//app/gazpar2mqtt.py", line 580, in

run(myParams)

File "//app/gazpar2mqtt.py", line 180, in run

myAccount.store(myDb)

AttributeError: 'NoneType' object has no attribute 'store'

Mandatory env variables when running with args

There is an issue too :

2021-11-18 21:47:03,411 Welcome to gazpar2mqtt
2021-11-18 21:47:03,411 -----------------------------------------------------------
2021-11-18 21:47:03,411 -----------------------------------------------------------
2021-11-18 21:47:03,412 Environement variable 'GRDF_USERNAME' is mandatory

so I comment the env part to bypass it.

Originally posted by @Minims in #11 (comment)

Additionnal datas from monespace.grdf.fr

I think it should possible to enhance the script fetching data from GRDF and get aditionnals data as :

Panel Tableau de bord :

  • Comparaison à l'echelle locale (Foyers les plus économes, Foyers les plus énergivores)
    image

Panel Consommations détaillées

  • Valeur seuil
  • Valeur année précédente
    image

Syntax error on mqtt connexion with username/password

​        ​# Set authentification
​        ​if​ ​username​ ​!=​ ​""​ ​and​ ​password​ ​!=​ ​""​:
​            ​client​.​username_pw_set​(​username​, ​password​)

Did you mean self.client line 21 of mqtt.py?

06-dev : calcul des intervalles glissants

Compte tenu des remontées ayant au moins 24h dans les données, je pense que les fenêtres glissantes devraient être calculées depuis J-1 et pas J.
Exemple ce jour :

Rolling month gas					Du 10/11/2021 au 09/12/2021 (voir pour plutôt faire du 09/11/2021 au 08/12/2021)
Rolling month of last 2 years gas			Voir décalage potentiel sur rolling month
Rolling month of last month gas				Voir décalage potentiel sur rolling month
Rolling month of last year gas				Voir décalage potentiel sur rolling month
Rolling week gas					Du 03/12/2021 au 09/12/2021 (voir pour plutôt faire du 02/12/2021 au 08/12/2021)
Rolling week of last 2 years gas			Voir décalage potentiel sur rolling week
Rolling week of last week gas				Voir décalage potentiel sur rolling week
Rolling week of last year gas				Voir décalage potentiel sur rolling week
Rolling year gas					Du 10/12/2020 au 09/12/2021 (Voir pour plutôt faire du 09/12/2020 au 08/12/2021)
Rolling year of last year gas				Voir décalage potentiel sur rolling year

Follow-up #40 : erreur si date d'activation supérieure à 3 ans

Follow up #40

2021-12-13 00:27:52,097 INFO PCE activation date : 2017-09-05
Traceback (most recent call last):
  File "/app/gazpar2mqtt.py", line 587, in <module>
    run(myParams)
  File "/app/gazpar2mqtt.py", line 214, in run
    startDate = minDate.date()
NameError: name 'minDate' is not defined
The app has crashed. Are you sure you entered the correct config options?

Ligne 214 de gazpar2mqtt.py :
startDate = minDate.date()
A remplacer par :
startDate = minDateTime.date()

Error retrieving measures

Traceback (most recent call last): File "//app/gazpar2mqtt.py", line 632, in <module> run(myParams) File "//app/gazpar2mqtt.py", line 221, in run myGrdf.getPceDailyMeasures(myPce,startDate,endDate) File "/app/gazpar.py", line 254, in getPceDailyMeasures for measure in measureList[pce.pceId]["releves"]: TypeError: list indices must be integers or slices, not str

Connexion MQTT KO

Bonsoir,

je ne comprends pas pourquoi le plugin n’arrive pas à se connecter à mon Mosquitto Server

2022-10-06 23:53:05,369 INFO Connect to Mqtt broker...
2022-10-06 23:53:05,369 DEBUG Mqtt connect : activation of callbacks
2022-10-06 23:53:05,370 DEBUG Mqtt connect : connection to broker core-mosquitto:1883...
2022-10-06 23:53:05,374 DEBUG Wait for conexion callback
2022-10-06 23:53:07,380 DEBUG Mqtt on_connect callback : Connection Refused: not authorised.
2022-10-06 23:53:07,381 ERROR Mqtt on_connect callback : connexion failed
2022-10-06 23:53:07,382 DEBUG Mqtt on_disconnect callback : Connection Refused: not authorised.
2022-10-06 23:53:07,382 ERROR Mqtt on_disconnect callback : broker has been disconnected unexpectly
2022-10-06 23:53:08,388 DEBUG Mqtt on_connect callback : Connection Refused: not authorised.
2022-10-06 23:53:08,388 ERROR Mqtt on_connect callback : connexion failed
2022-10-06 23:53:08,389 DEBUG Mqtt on_disconnect callback : Connection Refused: not authorised.
2022-10-06 23:53:08,390 ERROR Mqtt on_disconnect callback : broker has been disconnected unexpectly
2022-10-06 23:53:09,382 INFO ------------

je suis sûr à 100% de mes credentiels car je les utilise avec d’autre plugin.

Ma conf
GRDF_USERNAME: 'XXXX'
GRDF_PASSWORD: 'XXXX'
MQTT_HOST: 'core-mosquitto' #meme souci avec l’IP du broker
MQTT_USER: 'myMQTTUser'
MQTT_PASSWORD: 'myMQTTPass'
MQTT_PORT: '1883'
MQTT_TOPIC: 'gazpar'
MQTT_QOS: '1'
MQTT_RETAIN: 'True'
DEBUG: true

Merci pour votre aide.

HA discovery missing device part

autre chose pour le HaDiscovery, il manque une partie device dans la conf des sensors pour que gazpar apparaisse comme un nouvel appareil dans homeassistant et relie toutes les entités:

"device": 
{"identifiers": ["gazpar_xxx"], 
"name": "Gazpar xxx", 
"model": "Gazpar", 
"manufacturer": "GRDF"}
}

Originally posted by @Minims in #11 (comment)

Addon update on ARM/v7

Mettre à jour gazpar2mqtt
0.8.0 (19-01-2022)
Update to latest version from yukulehe/gazpar2mqtt
Automatic builds (reduced size, local wear, install duration...)
Une mise à jour est disponible pour gazpar2mqtt . Vous avez installé 0.7.0 Cliquez sur mettre à jour pour 0.8.0

Hassio Addon update is failing
Error : no matching manifest for linux/arm/v7 in the manifest list entries

Keep secret

bonjour à toi
je voulais savoir si on pouvait avoir les infos de connexion de cet addon gardées secrétes dans HA
comme par exemple

GRDF_USERNAME: !secret grdf.username
[11:01:12] FATAL: gazpar.username does not follow the structure KEY=text, it will be ignored and removed from the config

Connection issue when password contains any special character

I have an error while trying to connect, debug log below.
Would you please have any idea?
Many thanks.

2022-10-29 09:38:11,944 INFO Connexion to GRDF, try 1/14...
2022-10-29 09:38:11,967 DEBUG Starting new HTTPS connection (1): monespace.grdf.fr:443
2022-10-29 09:38:12,019 DEBUG https://monespace.grdf.fr:443 "GET /client/particulier/accueil HTTP/1.1" 302 138
2022-10-29 09:38:12,022 DEBUG Starting new HTTPS connection (1): sofa-connexion.grdf.fr:443
2022-10-29 09:38:12,069 DEBUG https://sofa-connexion.grdf.fr:443 "GET /openam/oauth2/externeGrdf/authorize?response_type=code&scope=openid+profile+email+infotravaux+/v1/accreditation+/v1/accreditations+/digiconso/v1+/digiconso/v1/consommations+new_meg+/Demande.read+/Demande.write+/digiraccob2c/v1&client_id=prod_espaceclient&state=%2Fclient%2Fparticulier%2Faccueil&redirect_uri=https://monespace.grdf.fr/_codexch&nonce=RSvM9B0xFLsQzthE_a4k8pocrCwzP2jfgcYpNnKJ1go&by_pass_okta=1&capp=meg HTTP/1.1" 302 0
2022-10-29 09:38:12,073 DEBUG Starting new HTTPS connection (1): login.monespace.grdf.fr:443
2022-10-29 09:38:12,119 DEBUG https://login.monespace.grdf.fr:443 "GET /mire/connexion?goto=https%3A%2F%2Fsofa-connexion.grdf.fr%3A443%2Fopenam%2Foauth2%2FexterneGrdf%2Fauthorize%3Fresponse_type%3Dcode%26scope%3Dopenid%2520profile%2520email%2520infotravaux%2520%252Fv1%252Faccreditation%2520%252Fv1%252Faccreditations%2520%252Fdigiconso%252Fv1%2520%252Fdigiconso%252Fv1%252Fconsommations%2520new_meg%2520%252FDemande.read%2520%252FDemande.write%2520%252Fdigiraccob2c%252Fv1%26client_id%3Dprod_espaceclient%26state%3D%252Fclient%252Fparticulier%252Faccueil%26redirect_uri%3Dhttps%253A%252F%252Fmonespace.grdf.fr%252F_codexch%26nonce%3DRSvM9B0xFLsQzthE_a4k8pocrCwzP2jfgcYpNnKJ1go%26by_pass_okta%3D1%26capp%3Dmeg&realm=/externeGrdf&capp=meg HTTP/1.1" 200 836
2022-10-29 09:38:12,120 DEBUG Cookies ok.
2022-10-29 09:38:12,120 DEBUG auth_nonce: 2bc3b7fc88c3abab871606c32f34dccd
2022-10-29 09:38:12,120 DEBUG Logging ...
2022-10-29 09:38:12,120 DEBUG Logging payload : {'email': '[email protected]', 'password': 'xxxxxxx', 'capp': 'meg', 'goto': 'https://sofa-connexion.grdf.fr:443/openam/oauth2/externeGrdf/authorize'}
2022-10-29 09:38:12,199 DEBUG https://login.monespace.grdf.fr:443 "POST /sofit-account-api/api/v1/auth HTTP/1.1" 200 None
2022-10-29 09:38:12,200 DEBUG Logging returned : {"state":"REINPUT","error":"AUTH_FAIL","actualLockoutDuration":0,"message":"password.incorrect","displayCaptcha":true,"surname":"xxxxx","name":"xxx","email":"[email protected]"}
2022-10-29 09:38:12,200 INFO <Response [200]>
2022-10-29 09:38:12,200 INFO <RequestsCookieJar[<Cookie XSRF-TOKEN=6828ad28-ddbb-4674-b539-9d8d96cda815 for .grdf.fr/>, , <Cookie JSESSIONID=85EED89D7557EA998DDB28FB06D72056 for login.monespace.grdf.fr/sofit-account-api>, <Cookie BIGipServerEXT_PRODPL-EXT_PROD-VS_P1_SIG-S_EPS_HTTPS_Internet=rd6o00000000000000000000ffff0a28a21ao443 for monespace.grdf.fr/>, , ]>
2022-10-29 09:38:12,200 INFO Login unsuccessful. Invalid returned information: {"state":"REINPUT","error":"AUTH_FAIL","actualLockoutDuration":0,"message":"password.incorrect","displayCaptcha":true,"surname":"xxxx","name":"xxxxxx","email":"[email protected]"}
2022-10-29 09:38:12,200 INFO Unable to login to GRDF website
2022-10-29 09:38:12,200 INFO Wait 20 seconds (0 min) before next try

ERROR Mqtt on_disconnect callback : broker has been disconnected unexpectly

Problème de déconnexion intempestif du serveur mqtt :
ERROR Mqtt on_disconnect callback : broker has been disconnected

Dans les logs du serveur mqtt, on voit qu'il clôt la connexion car déjà connecté :

1657973744: New connection from 172.17.0.1 on port 1883.
1657973744: Client gazpar2mqtt already connected, closing old connection.

Probleme installation docker

Bonjour,

Tout d'abord merci pour ton projet 👍
Lors de l'installation sur docker avec la commande suivante j'ai l'erreur ci dessous

docker run --name gazpar2mqtt -e GRDF_USERNAME=XXXX -e GRDF_PASSWORD=XXXXX -e MQTT_USERNAME=XXX e- MQTT_PASSWORD=XXXX -e MQTT_HOST=192.168.1.54 -e MQTT_PORT=1883 -e MQTT_CLIENTID=gazou -e MQTT_QOS=1 -e MQTT_TOPIC=gazpar -e MQTT_RETAIN=False --tty yukulehe/gazpar2mqtt:latest

image

Merci d'avance pour ton aide
Emilien

Attribution pour un portage?

Je suis en train, dans le cadre de la création d'une librairie avec plein de trucs d'accès à l'énergie (avec notamment Linky en plus), et, en particulier, de faire un portage de la partie gazpar.py de ce projet en C#.

Comme ce projet est licencié en GPL, je mettrai le mien sous cette licence aussi, mais je me pose la question de l'attribution de votre travail sur la partie Gazpar. Dans un tel cas, la réponse canonique semble être: demandez aux intéressés comment ils veulent que leur travail leur soit attribué.

Et du coup, comment souhaitez-vous que votre travail vous soit attribué?

Unable to login to GRDF website

image

Il semble qu'il y ait des problèmes pour se connecter au site de GRDF. En espérant que tout cela se mette en place naturellement.
Comme je pars en vacances, je ne pourrais pas assurer la maintenance de l'appli :P
Bonnes vacances à vous aussi si vous partez.

Connect to InfluxDB using HTTPS

Hello,
Mon instance InfluxDB n'est accessible qu'en HTTPS, est-ce possible d'avoir une variable d'environnement INFLUXDB_SCHEME qu'on pourrait passer en https au besoin ?

Merci

GRDF API breakout

It seems that from this day, the calls to GRDF mon espace do not work anymore. I may help to solve this. It seems that we are talking about complete rewrite of gazpar.py.

0.6-dev : daily_gas et gas incohérents

Dans la 0.6-dev, le daily_gas et gas reprennent tel quel le volumeConsomme de GRDF, cependant toutes les autres mesures de volumes semblent utiliser une différence entre indexFin et indexDebut. Dans mon exemple cela génère une petite différence, notamment avec Day-3 gas alors qu'il s'agit réellement de la même mesure, ce qui est dommage.

image

Par souci de cohérence, je pense qu'il faudrait que tous les volumes soient calculés de la même façon, même si en cas de "trous" cela risque de poser problème (exemple ci-dessous), à moins qu'il soit possible de dynamiquement remplacer le indexDebut par le dernier indexFin connu :

            {
                "coeffConversion": 10.73,
                "dateDebutReleve": "2021-02-08T06:00:00+01:00",
                "dateFinReleve": "2021-02-09T06:00:00+01:00",
                "energieConsomme": 164,
                "frequenceReleve": null,
                "indexDebut": 10769,
                "indexFin": 10784,
                "journeeGaziere": "2021-02-08",
                "natureReleve": "Informative Journalier",
                "pcs": null,
                "pta": null,
                "qualificationReleve": "Mesur\u00e9",
                "status": null,
                "temperature": null,
                "volumeBrutConsomme": 15,
                "volumeConverti": null
            },
            {
                "coeffConversion": null,
                "dateDebutReleve": "2021-02-09T06:00:00+01:00",
                "dateFinReleve": "2021-02-10T06:00:00+01:00",
                "energieConsomme": null,
                "frequenceReleve": null,
                "indexDebut": null,
                "indexFin": null,
                "journeeGaziere": "2021-02-09",
                "natureReleve": null,
                "pcs": null,
                "pta": null,
                "qualificationReleve": "Absence de Donn\u00e9es",
                "status": null,
                "temperature": null,
                "volumeBrutConsomme": null,
                "volumeConverti": null
            },
            {
                "coeffConversion": 10.73,
                "dateDebutReleve": "2021-02-10T06:00:00+01:00",
                "dateFinReleve": "2021-02-11T06:00:00+01:00",
                "energieConsomme": 177,
                "frequenceReleve": null,
                "indexDebut": null,
                "indexFin": 10815,
                "journeeGaziere": "2021-02-10",
                "natureReleve": "Informative Journalier",
                "pcs": null,
                "pta": null,
                "qualificationReleve": "Mesur\u00e9",
                "status": null,
                "temperature": null,
                "volumeBrutConsomme": 17,
                "volumeConverti": null
            },

Unable to launch the script

Bonjour ,
Uubuntu, version server 20.4

Je lance ... puis

python3 app/gazpar2mqtt.py --grdf_username=#####@#### --grdf_password=####### --mqtt_host=192.168.88.150 --mqtt_clientId=gazou --mqtt_retain=True --db_init True'

2022-03-09 08:33:35,553 INFO -----------------------------------------------------------
2022-03-09 08:33:35,553 INFO #               Welcome to gazpar2mqtt                    #
2022-03-09 08:33:35,553 INFO -----------------------------------------------------------
2022-03-09 08:33:35,554 INFO Program version : 0.8.1
2022-03-09 08:33:35,554 INFO Database version : 0.8.0
2022-03-09 08:33:35,554 INFO Influxdb version : 0.8.0
2022-03-09 08:33:35,554 INFO Please note that the the tool is still under development, various functions may disappear or be modified.
2022-03-09 08:33:35,554 INFO -----------------------------------------------------------
2022-03-09 08:33:35,554 INFO #                Program parameters                       #
2022-03-09 08:33:35,554 INFO -----------------------------------------------------------
2022-03-09 08:33:35,554 INFO GRDF config : username = ******@****.**, password = ******
2022-03-09 08:33:35,554 INFO MQTT broker config : host = 192.168.88.150, port = 1883, clientId = gazou, qos = 1, topic = gazpar, retain = True, ssl = False
2022-03-09 08:33:35,554 INFO Standlone mode : Enable = True
2022-03-09 08:33:35,555 INFO Home Assistant discovery : Enable = False
2022-03-09 08:33:35,555 INFO Thresold options : Warning percentage = 80
2022-03-09 08:33:35,555 INFO Influxdb config : Enable = False
2022-03-09 08:33:35,555 INFO Price config : Default price = 0.07 €/kWh, default fix price = 0.9 €/day, path to file = /data
2022-03-09 08:33:35,555 INFO Database options : Force reinitialization = True, Path = /data
2022-03-09 08:33:35,555 INFO Debug mode : Enable = False
2022-03-09 08:33:35,555 INFO Check parameters...
2022-03-09 08:33:35,555 INFO Parameters are ok !
2022-03-09 08:33:35,555 INFO -----------------------------------------------------------
2022-03-09 08:33:35,556 INFO #        Connexion to SQLite database                     #
2022-03-09 08:33:35,556 INFO -----------------------------------------------------------
2022-03-09 08:33:35,556 INFO Connexion to SQLite database...
Traceback (most recent call last):
  File "app/gazpar2mqtt.py", line 891, in <module>
    run(myParams)
  File "app/gazpar2mqtt.py", line 74, in run
    myDb.connect(G2M_VERSION,G2M_DB_VERSION,G2M_INFLUXDB_VERSION)
  File "/home/airvb/gazpar2mqtt-main/app/database.py", line 162, in connect
    os.mkdir(self.path)
PermissionError: [Errno 13] Permission denied: '/data'

Une idée ?

Use energy values as first line.

Hello,
thank you for this great tool.

I'm wondering why :

  1. you truncate volume values to int (m³ is quite large unit).
    If you get the more precise values, why not keep them.
    → remove int() for gas volume storage
  2. volume is provided mainly in volume.
    Though this is the primary measure index, all usages (pricing computation, comparison to other energy source,…) would be done with the kWh energy values (through the timely dependent conversion factor). With the unique conversion factor, past date comparison is not meaningful — my current gas volume consumption can be compared to the consumption one year ago only if I get the conversion factor at both dates.
    → at least provide energy equivalent to all gas mqtt topics

Connexion impossible au site GRDF

Bonjour,
Je n'arrive pas à me connecter au site GRDF, je pense que cela vient du capcha...
par ailleurs, je me connecte sans problème via mon navigateur internet.
Merci d'avance,

2023-01-20 11:53:58,110 INFO # Program parameters # 2023-01-20 11:53:58,111 INFO ----------------------------------------------------------- 2023-01-20 11:53:58,111 INFO GRDF config : username = ******@****.**, password = ****** 2023-01-20 11:53:58,111 INFO MQTT broker config : host = core-mosquitto, port = 1883, clientId = gazpar2mqtt, qos = 0, topic = gazpar2mqtt, retain = True, ssl = False 2023-01-20 11:53:58,111 INFO Standlone mode : Enable = True 2023-01-20 11:53:58,111 INFO Home Assistant discovery : Enable = False 2023-01-20 11:53:58,112 INFO Thresold options : Warning percentage = 80 2023-01-20 11:53:58,112 INFO Influxdb config : Enable = False 2023-01-20 11:53:58,112 INFO Price config : Default price = 0.07 €/kWh, default fix price = 0.9 €/day, path to file = /data 2023-01-20 11:53:58,112 INFO Database options : Force reinitialization = False, Path = /data 2023-01-20 11:53:58,112 INFO Debug mode : Enable = False 2023-01-20 11:53:58,113 INFO Check parameters... 2023-01-20 11:53:58,113 INFO Parameters are ok ! 2023-01-20 11:53:58,113 INFO ----------------------------------------------------------- 2023-01-20 11:53:58,113 INFO # Connexion to SQLite database # 2023-01-20 11:53:58,113 INFO ----------------------------------------------------------- 2023-01-20 11:53:58,113 INFO Connexion to SQLite database... 2023-01-20 11:53:58,119 INFO SQLite database connected ! 2023-01-20 11:53:58,121 INFO Last execution date 2023-01-20 10:49:33.767458, program was in version 0.8.2. 2023-01-20 11:53:58,121 INFO Checking database version... 2023-01-20 11:53:58,122 INFO Your database is already up to date : version 0.8.0. 2023-01-20 11:53:58,123 INFO Retrieve database statistics... 2023-01-20 11:53:58,124 INFO 0 informatives measures stored 2023-01-20 11:53:58,124 INFO 0 PCE(s) 2023-01-20 11:53:58,124 INFO First measure : None 2023-01-20 11:53:58,126 INFO Last measure : None 2023-01-20 11:53:58,126 INFO ----------------------------------------------------------- 2023-01-20 11:53:58,127 INFO # Connexion to Mqtt broker # 2023-01-20 11:53:58,128 INFO ----------------------------------------------------------- 2023-01-20 11:53:58,128 INFO Connect to Mqtt broker... 2023-01-20 11:54:02,141 INFO Mqtt broker connected ! 2023-01-20 11:54:02,142 INFO ----------------------------------------------------------- 2023-01-20 11:54:02,142 INFO # Get data from GRDF website # 2023-01-20 11:54:02,142 INFO ----------------------------------------------------------- 2023-01-20 11:54:02,143 INFO Connexion to GRDF, try 1/14... 2023-01-20 11:54:02,450 INFO <Response [200]> 2023-01-20 11:54:02,451 INFO <RequestsCookieJar[<Cookie XSRF-TOKEN=ab53517c-8e29-4361-9047-85e20133110e for .grdf.fr/>, <Cookie ROUTEID=.1 for login.monespace.grdf.fr/>, <Cookie JSESSIONID=74BA23CFAE3258B0A86168E1DC709938 for login.monespace.grdf.fr/sofit-account-api>, <Cookie BIGipServer~EXT_PROD~PL-EXT_PROD-VS_P1_SIG-S_EPS_HTTPS_Internet=rd6o00000000000000000000ffff0a28a21ao443 for monespace.grdf.fr/>, <Cookie auth_nonce=dd9fc31e15d70d4a0bc4ee5c56055f5a for monespace.grdf.fr/>, <Cookie auth_redir=https://monespace.grdf.fr/ for monespace.grdf.fr/>]> 2023-01-20 11:54:02,452 INFO Login unsuccessful. Invalid returned information: {"state":"REINPUT","error":"LOGIN_INVALID_ATTEMPTS","actualLockoutDuration":0,"message":"login.error.invalidattempts","displayCaptcha":true,"surname":"SURNAME","name":"NAME","email":"[email protected]"} 2023-01-20 11:54:02,452 INFO Unable to login to GRDF website 2023-01-20 11:54:02,453 INFO Wait 20 seconds (0 min) before next try

Erreur connexion GRDF corrigée

Bonjour
Merci pour votre réponse rapide
Pour info
Après nouveaux tests comme vous le recommandiez et "avoir mieux lu le log" en faite mon problème de connexion bloquait sur mon mot de passe
Celui ci comportait un & et un %
Depuis changement du mdp sur le site de GRDF celui-ci passe dans votre appli
Merci et Bravo pour la modif
Je vais pouvoir poursuivre sur l'intégration mqtt pour Domoticz que je n'ai pas encore vraiment testé du coup

Credential from config.yaml issue

Sans rien changer à la configuration je vois dans les traces que GRDF_USERNAME est bien lu mais je tombe sur ce message :

​        ​logging​.​error​(​"Parameter GRDF username is mandatory."​)

0.6-dev : previous week of last year

La valeur previous week of last year me semble mal calculée. A moins de sélectionner une plage de 8 jours, je ne retrouve jamais la valeur retournée, en outre j'ai l'impression que c'est plutôt current week of last year.

Erreur de sélection plage de dates

Il semble que gazpar2mqtt récupère désormais une date d'activation du PCE et s'en sert de borne inférieure pour la récupération des données. Or si cette date a plus de 3 ans, l'API e-conso renvoie une erreur :
{"code":400,"message":"Bad Request"}

On retrouve cette erreur dans le journal :

2021-12-11 23:30:59,804 INFO Get measures of PCE xxxxxxxxxxxxxxx alias xxxxxxxxxxxxxxx
2021-12-11 23:30:59,804 INFO ---------------------------------
2021-12-11 23:30:59,804 INFO PCE activation date : 2017-09-05
2021-12-11 23:30:59,805 INFO Range period : from 2017-09-05 to 2021-12-11...
2021-12-11 23:30:59,859 DEBUG https://monespace.grdf.fr:443 "GET /api/e-conso/pce/consommation/informatives?dateDebut=2017-09-05&dateFin=2021-12-11&pceList%5B%5D=xxxxxxxxxxxxxxxxx HTTP/1.1" 400 None
Traceback (most recent call last):
  File "/app/gazpar2mqtt.py", line 583, in <module>
    run(myParams)
  File "/app/gazpar2mqtt.py", line 215, in run
    myGrdf.getPceDailyMeasures(myPce,startDate,endDate)
  File "/app/gazpar.py", line 253, in getPceDailyMeasures
    for measure in measureList[pce.pceId]["releves"]:
KeyError: 'xxxxxxxxxxxxxxxxx'
The app has crashed. Are you sure you entered the correct config options?

A ce jour l'API e-conso fonctionne si je met 2018-12-11 en borne inférieure, mais pas 2018-12-10. Il faudrait donc définir au maximum dateFin - 3 ans comme dateDebut quand le PCE activation date est avant cette date.

Problème Connection GRDF

Auriez vous une explication ? Merci

Do you have an explanation attached to the debug ?

2021-12-06 13:08:16,023 Get data from GRDF website
2021-12-06 13:08:16,024 -----------------------------------------------------------
2021-12-06 13:08:16,025 Connexion to GRDF, try 1/5...
2021-12-06 13:08:16,969 GRDF connected !
2021-12-06 13:08:16,969 Retrieve account informations
2021-12-06 13:08:17,062 Unable to get GRDF account informations !
2021-12-06 13:08:17,062 Retrieve list of PCEs...
2021-12-06 13:08:17,140 Unable to get PCE !

2021-12-06 13:08:17,141 -----------------------------------------------------------
2021-12-06 13:08:17,141 Disconnexion from MQTT
2021-12-06 13:08:17,142 -----------------------------------------------------------
2021-12-06 13:08:18,025 Mqtt broker disconnected

cannot connect to Mqtt

I cannot connect to Mqtt, I don't know why for now.
I have tried to run the script directly on my Debian, I have the same issue.
So it seems not related to the add-on.

Originally posted by @Minims in #5 (comment)

password en clair

Bonjour
Est il normal de voir le mot de passe dans le log de l'addon alors que l'option secret est utilisée
Peux tu le masquer stp ?

Unable to override port in add-on

Unable to override and convert new port to integer

config

MQTT_HOST: '192.168.1.10'
MQTT_PORT: 1883

addon log

MQTT_HOST="192.168.1.10"
MQTT_PORT="1883"
..
2021-11-18 22:38:05,810 Welcome to gazpar2mqtt
2021-11-18 22:38:05,810 -----------------------------------------------------------
2021-11-18 22:38:05,810 -----------------------------------------------------------
Traceback (most recent call last):
  File "/app/gazpar2mqtt.py", line 742, in <module>
    params = _getEnvParams()
  File "/app/gazpar2mqtt.py", line 107, in _getEnvParams
    params["mqtt", "port"] = int(os.environ["MQTT_PORT"])
ValueError: invalid literal for int() with base 10: '"1883"'
[22:38:05] FATAL: The app has crashed. Are you sure you entered the correct config options?
``

Home Assistant discovery mode : publish error when alias is None

Bonjour,

J'ai une erreur avec le discovery mode Home Assistant, tout est publié correctement en mode Standalone (vérifié avec MQTT Explorer) mais j'ai l'erreur suivante à l'étape Home assistant publication mode :

ERROR Home Assistant discovery mode : unable to publish value to mqtt broker

Je ne sais pas si c'est un bug ou quelque chose que j'ai mal fait... Ci-dessous les logs complets si besoin, merci !

2022-08-04 11:33:45,684 INFO -----------------------------------------------------------
2022-08-04 11:33:45,687 INFO #               Welcome to gazpar2mqtt                    #
2022-08-04 11:33:45,691 INFO -----------------------------------------------------------
2022-08-04 11:33:45,695 INFO Program version : 0.8.2
2022-08-04 11:33:45,700 INFO Database version : 0.8.0
2022-08-04 11:33:45,704 INFO Influxdb version : 0.8.0
2022-08-04 11:33:45,708 INFO Please note that the the tool is still under development, various functions may disappear or be modified.
2022-08-04 11:33:45,711 INFO -----------------------------------------------------------
2022-08-04 11:33:45,714 INFO #                Program parameters                       #
2022-08-04 11:33:45,719 INFO -----------------------------------------------------------
2022-08-04 11:33:45,721 INFO GRDF config : username = ******@****.**, password = ******
2022-08-04 11:33:45,726 INFO MQTT broker config : host = ***.***.*.**, port = 1883, clientId = gazpar2mqtt, qos = 1, topic = gazpar, retain = False, ssl = False
2022-08-04 11:33:45,730 INFO Standlone mode : Enable = True
2022-08-04 11:33:45,735 INFO Home Assistant discovery : Enable = True, Topic prefix = homeassistant, Device name = gazpar
2022-08-04 11:33:45,737 INFO Thresold options : Warning percentage = 80
2022-08-04 11:33:45,743 INFO Influxdb config : Enable = False
2022-08-04 11:33:45,747 INFO Price config : Default price = 0.07 €/kWh, default fix price = 0.9 €/day, path to file = /data
2022-08-04 11:33:45,750 INFO Database options : Force reinitialization = False, Path = /home/pi/gazpar2mqtt-data
2022-08-04 11:33:45,753 INFO Debug mode : Enable = False
2022-08-04 11:33:45,757 INFO Check parameters...
2022-08-04 11:33:45,761 INFO Parameters are ok !
2022-08-04 11:33:45,764 INFO -----------------------------------------------------------
2022-08-04 11:33:45,768 INFO #        Connexion to SQLite database                     #
2022-08-04 11:33:45,773 INFO -----------------------------------------------------------
2022-08-04 11:33:45,776 INFO Connexion to SQLite database...
2022-08-04 11:33:45,784 INFO SQLite database connected !
2022-08-04 11:33:45,792 INFO Last execution date 2022-08-04 11:16:26.844249, program was in version 0.8.2.
2022-08-04 11:33:45,795 INFO Checking database version...
2022-08-04 11:33:45,799 INFO Your database is already up to date : version 0.8.0.
2022-08-04 11:33:45,802 INFO Retrieve database statistics...
2022-08-04 11:33:45,809 INFO 1 informatives measures stored
2022-08-04 11:33:45,812 INFO 1 PCE(s)
2022-08-04 11:33:45,816 INFO First measure : 2022-07-11
2022-08-04 11:33:45,821 INFO Last measure : 2022-07-11
2022-08-04 11:33:45,823 INFO -----------------------------------------------------------
2022-08-04 11:33:45,828 INFO #              Connexion to Mqtt broker                   #
2022-08-04 11:33:45,832 INFO -----------------------------------------------------------
2022-08-04 11:33:45,835 INFO Connect to Mqtt broker...
2022-08-04 11:33:49,857 INFO Mqtt broker connected !
2022-08-04 11:33:49,861 INFO -----------------------------------------------------------
2022-08-04 11:33:49,865 INFO #            Get data from GRDF website                   #
2022-08-04 11:33:49,869 INFO -----------------------------------------------------------
2022-08-04 11:33:49,873 INFO Connexion to GRDF, try 1/14...
2022-08-04 11:33:52,262 INFO GRDF connected !
2022-08-04 11:33:52,265 INFO Retrieve account informations
2022-08-04 11:33:52,444 INFO Retrieve list of PCEs...
2022-08-04 11:33:52,589 INFO 1 PCE found !
2022-08-04 11:33:52,611 INFO ---------------------------------
2022-08-04 11:33:52,614 INFO Get measures of PCE 43************ alias None
2022-08-04 11:33:52,618 INFO Range period : from 2019-08-04 (3 years ago) to 2022-08-04 (today) ...
2022-08-04 11:33:52,621 INFO ---------------
2022-08-04 11:33:52,624 INFO Retrieve informative measures...
2022-08-04 11:33:52,786 INFO Informative measures found !
2022-08-04 11:33:52,789 INFO Analysis of informative measures provided by GRDF...
2022-08-04 11:33:52,792 INFO 21 informative measures provided by Grdf
2022-08-04 11:33:52,795 INFO 1 informative measures are ok
2022-08-04 11:33:52,798 INFO Accuracy is 5 percent
2022-08-04 11:33:52,801 INFO Last valid informative measure provided by GRDF : 
2022-08-04 11:33:52,804 INFO Date = 2022-07-11
2022-08-04 11:33:52,808 INFO Start index = 117, End index = 117
2022-08-04 11:33:52,811 INFO Volume = 0 m3, Energy = 0 kWh, Factor = 11.36
2022-08-04 11:33:52,814 WARNING Inconsistencies detected on the measure : 
2022-08-04 11:33:52,817 WARNING Volume provided by Grdf (1 m3) has been replaced by the volume between start index and end index (0 m3)
2022-08-04 11:33:52,820 INFO ---------------
2022-08-04 11:33:52,822 INFO Retrieve published measures...
2022-08-04 11:33:52,941 INFO Published measures found !
2022-08-04 11:33:52,943 INFO Analysis of published measures provided by GRDF...
2022-08-04 11:33:52,945 INFO 3 published measures provided by Grdf
2022-08-04 11:33:52,947 INFO 1 published measures are ok
2022-08-04 11:33:52,950 INFO Accuracy is 33 percent
2022-08-04 11:33:52,952 INFO Last valid published measure provided by GRDF : 
2022-08-04 11:33:52,954 INFO Start date = 2022-07-11 06:00:00, End date = 2022-07-16 06:00:00
2022-08-04 11:33:52,956 INFO Start index = 117, End index = 118
2022-08-04 11:33:52,958 INFO Volume = 1 m3, Energy = 11 kWh, Factor = 11.36
2022-08-04 11:33:52,960 INFO ---------------
2022-08-04 11:33:52,962 INFO Update of database with retrieved measures...
2022-08-04 11:33:52,990 INFO Database updated !
2022-08-04 11:33:52,992 INFO ---------------
2022-08-04 11:33:52,994 INFO Retrieve PCE's thresolds from GRDF...
2022-08-04 11:33:53,352 ERROR Error to get PCE's thresolds from GRDF
2022-08-04 11:33:53,478 INFO -----------------------------------------------------------
2022-08-04 11:33:53,481 INFO #                    Load prices                           #
2022-08-04 11:33:53,484 INFO -----------------------------------------------------------
2022-08-04 11:33:53,486 INFO Loading prices from file prices.csv of directory /data
2022-08-04 11:33:53,490 WARNING Unable to find price file prices.csv in directory /data
2022-08-04 11:33:53,495 INFO -----------------------------------------------------------
2022-08-04 11:33:53,505 INFO #           Stand alone publication mode                  #
2022-08-04 11:33:53,508 INFO -----------------------------------------------------------
2022-08-04 11:33:53,511 INFO Publishing values of PCE 43************ alias None...
2022-08-04 11:33:53,514 INFO ---------------------------------
2022-08-04 11:33:53,518 INFO You can retrieve published values subscribing topic gazpar/43************/#
2022-08-04 11:33:53,527 INFO Publishing to Mqtt...
2022-08-04 11:34:02,023 INFO All measures published !
2022-08-04 11:34:02,026 INFO Publishing to Mqtt status values...
2022-08-04 11:34:02,438 INFO Status values published !
2022-08-04 11:34:02,442 INFO -----------------------------------------------------------
2022-08-04 11:34:02,446 INFO #           Home assistant publication mode               #
2022-08-04 11:34:02,450 INFO -----------------------------------------------------------
2022-08-04 11:34:02,456 INFO Publishing values of PCE 43************ alias None...
2022-08-04 11:34:02,462 INFO ---------------------------------
2022-08-04 11:34:02,466 ERROR Home Assistant discovery mode : unable to publish value to mqtt broker
2022-08-04 11:34:02,471 INFO -----------------------------------------------------------
2022-08-04 11:34:02,477 INFO #               Disconnexion from MQTT                    #
2022-08-04 11:34:02,482 INFO -----------------------------------------------------------
2022-08-04 11:34:03,255 INFO Mqtt broker disconnected
2022-08-04 11:34:03,259 INFO -----------------------------------------------------------
2022-08-04 11:34:03,263 INFO #          Disconnexion from SQLite database              #
2022-08-04 11:34:03,270 INFO -----------------------------------------------------------
2022-08-04 11:34:03,280 INFO SQLite database disconnected
2022-08-04 11:34:03,285 INFO -----------------------------------------------------------
2022-08-04 11:34:03,289 INFO #                Next run                                 #
2022-08-04 11:34:03,294 INFO -----------------------------------------------------------
2022-08-04 11:34:03,299 INFO No schedule defined.
2022-08-04 11:34:03,304 INFO -----------------------------------------------------------
2022-08-04 11:34:03,309 INFO #                  End of program                         #
2022-08-04 11:34:03,315 INFO -----------------------------------------------------------
2022-08-04 11:34:03,320 INFO End of gazpar2mqtt. See u...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.