yukulehe / gazpar2mqtt

Python script to fetch GRDF's website data and publish data to a mqtt broker.
GNU General Public License v3.0
21 stars 9 forks source link

Unable to launch the script #67

Closed airvb closed 2 years ago

airvb commented 2 years ago

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 ?

yukulehe commented 2 years ago

Hello, Le message semble clair. Le user qui lance le script n'a pas d'autorisation pour créer le répertoire /data (commande mkdir). Soit tu changes les permissions de ton user, soit tu fournis un autre répertoire sur lequel ton user a les droits de modification.

yukulehe commented 2 years ago

De mon côté, faudra que je modifie le script pour que ça plante proprement.

airvb commented 2 years ago

Merci pour ta réponse. J'essaie donc en modifiant le path du dossier d'installation pour être ds mon home, ce qui normalement devrait me permettre de créer le dossier. Mais le paramètre ne semble pas pris en compte.

python3 app/gazpar2mqtt.py --grdf_username=@free.fr --grdf_password=####### --mqtt_host=192.168.88.150 --mqtt_clientId=gazou --mqtt_retain=True --db_init True --db_path /home/airvb/gazpar2mqtt-main/data

2022-03-09 09:07:58,517 INFO -----------------------------------------------------------
2022-03-09 09:07:58,517 INFO #               Welcome to gazpar2mqtt                    #
2022-03-09 09:07:58,517 INFO -----------------------------------------------------------
2022-03-09 09:07:58,517 INFO Program version : 0.8.1
2022-03-09 09:07:58,517 INFO Database version : 0.8.0
2022-03-09 09:07:58,517 INFO Influxdb version : 0.8.0
2022-03-09 09:07:58,517 INFO Please note that the the tool is still under development, various functions may disappear or be modified.
2022-03-09 09:07:58,517 INFO -----------------------------------------------------------
2022-03-09 09:07:58,517 INFO #                Program parameters                       #
2022-03-09 09:07:58,517 INFO -----------------------------------------------------------
2022-03-09 09:07:58,518 INFO GRDF config : username = ******@****.**, password = ******
2022-03-09 09:07:58,518 INFO MQTT broker config : host = 192.168.88.150, port = 1883, clientId = gazou, qos = 1, topic = gazpar, retain = True, ssl = False
2022-03-09 09:07:58,518 INFO Standlone mode : Enable = True
2022-03-09 09:07:58,519 INFO Home Assistant discovery : Enable = False
2022-03-09 09:07:58,519 INFO Thresold options : Warning percentage = 80
2022-03-09 09:07:58,519 INFO Influxdb config : Enable = False
2022-03-09 09:07:58,519 INFO Price config : Default price = 0.07 €/kWh, default fix price = 0.9 €/day, path to file = /data
2022-03-09 09:07:58,519 INFO Database options : Force reinitialization = True, Path = /data
2022-03-09 09:07:58,519 INFO Debug mode : Enable = False
2022-03-09 09:07:58,519 INFO Check parameters...
2022-03-09 09:07:58,519 INFO Parameters are ok !
2022-03-09 09:07:58,519 INFO -----------------------------------------------------------
2022-03-09 09:07:58,519 INFO #        Connexion to SQLite database                     #
2022-03-09 09:07:58,519 INFO -----------------------------------------------------------
2022-03-09 09:07:58,519 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'

`

yukulehe commented 2 years ago

Bizarre. J'ai vérifié le code, je ne comprends pas pourquoi ton argument n'est pas pris en compte. Faut que je teste chez moi.

yukulehe commented 2 years ago

J'ai reproduis l'anomalie. Je fais la correction.

yukulehe commented 2 years ago

C'est corrigé directement dans le main. Je te laisse vérifier.

airvb commented 2 years ago

Super ça fonctionne. Je continue à explorer les différentes fonctions.

MERCI