[Tuto] Consomation d'eau ajout simple dans DomoticZ

Vous avez créé un script LUA dont vous êtes fier, un .sh génial, un programme Python hors du commun, un Tuto, c'est ici que vous pouvez les partager.
sirus
Messages : 131
Inscription : 05 mai 2015, 18:09
Contact :

Re: [TUTO] Consomation d'eau ajout simple dans domoticz

Message par sirus »

Le code fonctionne maintenant pour les sites suivants :

SDEI : lyonnaise-des-eaux.fr

SOGEST : sogest.info

SENART : eauxdesenart.com


N'hesitez pas si vous avez aussi une facture Lyonaise des eaux ou suez environnement a tester et faire un retour ici !
Raspberry B+ & PI2 / Domoticz / RFXtrx433E / multiple homemade devices
My blog/tutos for domoticz / electronics stuff : domotique.web2diz.net
manuloup
Messages : 781
Inscription : 18 févr. 2015, 13:05

Re: [TUTO] Consomation d'eau ajout simple dans domoticz

Message par manuloup »

Pas de compteur RF chez moi, snif :(
Synology DS920+ avec VM Debian 12, Aeon Labs Z-Stick Gen5, Aeon Zwave et devices zwaves , Teleinfo USB, devices Zigbee, batterie Marstek Venus E, Shelly Pro 3EM...
atlantis007
Messages : 65
Inscription : 11 janv. 2015, 22:31
Localisation : biarritz (64)

Re: [TUTO] Consomation d'eau ajout simple dans domoticz

Message par atlantis007 »

bonjour
j ai un souci je récupéré bien les données mais elle ne s affiche pas dans domoticz

vous une solution merci
sirus
Messages : 131
Inscription : 05 mai 2015, 18:09
Contact :

Re: [TUTO] Consomation d'eau ajout simple dans domoticz

Message par sirus »

Bonjour atlantis007

Sans plus d'information il est difficile pour nous de taider. Tu pourrai nous donner le contenu du fichier 2015-09.dat?

Aucun message d'erreur quand tu lances le script?
Raspberry B+ & PI2 / Domoticz / RFXtrx433E / multiple homemade devices
My blog/tutos for domoticz / electronics stuff : domotique.web2diz.net
atlantis007
Messages : 65
Inscription : 11 janv. 2015, 22:31
Localisation : biarritz (64)

Re: [TUTO] Consomation d'eau ajout simple dans domoticz

Message par atlantis007 »

bonjour sirus voici le contenu du fichier 2015-09

Code : Tout sélectionner

01/09/2015,0.306,493.877
02/09/2015,0.268,494.145
03/09/2015,0.282,494.427
04/09/2015,0.317,494.744
05/09/2015,0.364,495.108
06/09/2015,0.341,495.449
07/09/2015,0.3,495.749
08/09/2015,0.239,495.988
09/09/2015,0.265,496.253
10/09/2015,0.444,496.697
11/09/2015,0.362,497.059
12/09/2015,0.149,497.208
13/09/2015,0,497.721
il ma l aire normal je pense
sirus
Messages : 131
Inscription : 05 mai 2015, 18:09
Contact :

Re: [TUTO] Consomation d'eau ajout simple dans domoticz

Message par sirus »

Oui il est parfait ! Il est même très joli !!


Que donnent les fichiers SQL ?
et la log quand tu executes le script ?
Raspberry B+ & PI2 / Domoticz / RFXtrx433E / multiple homemade devices
My blog/tutos for domoticz / electronics stuff : domotique.web2diz.net
atlantis007
Messages : 65
Inscription : 11 janv. 2015, 22:31
Localisation : biarritz (64)

Re: [TUTO] Consomation d'eau ajout simple dans domoticz

Message par atlantis007 »

voici mon sql

Code : Tout sélectionner

DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-01'; INSERT INTO `Meter_Calendar` VALUES ('888', '30.6', '493.877', '2015-09-01' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-02'; INSERT INTO `Meter_Calendar` VALUES ('888', '26.8', '494.145', '2015-09-02' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-03'; INSERT INTO `Meter_Calendar` VALUES ('888', '28.2', '494.427', '2015-09-03' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-04'; INSERT INTO `Meter_Calendar` VALUES ('888', '31.7', '494.744', '2015-09-04' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-05'; INSERT INTO `Meter_Calendar` VALUES ('888', '36.4', '495.108', '2015-09-05' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-06'; INSERT INTO `Meter_Calendar` VALUES ('888', '34.1', '495.449', '2015-09-06' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-07'; INSERT INTO `Meter_Calendar` VALUES ('888', '30', '495.749', '2015-09-07' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-08'; INSERT INTO `Meter_Calendar` VALUES ('888', '23.9', '495.988', '2015-09-08' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-09'; INSERT INTO `Meter_Calendar` VALUES ('888', '26.5', '496.253', '2015-09-09' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-10'; INSERT INTO `Meter_Calendar` VALUES ('888', '44.4', '496.697', '2015-09-10' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-11'; INSERT INTO `Meter_Calendar` VALUES ('888', '36.2', '497.059', '2015-09-11' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-12'; INSERT INTO `Meter_Calendar` VALUES ('888', '14.9', '497.208', '2015-09-12' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-13'; INSERT INTO `Meter_Calendar` VALUES ('888', '51.3', '497.721', '2015-09-13' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-14'; INSERT INTO `Meter_Calendar` VALUES ('888', '24.6', '497.967', '2015-09-14' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-15'; INSERT INTO `Meter_Calendar` VALUES ('888', '35', '498.317', '2015-09-15' );
et le log

Code : Tout sélectionner

 /home/pi/EAU/updateConsoEau.sh
/home/pi/EAU/updateConsoEau.sh[21]: [: argument expected

 - PART 1 Get the data from website for 2015-09

 /home/pi/EAU/2015-09.dat  generated

 - PART 2 Update .dat file

 /home/pi/EAU/2015-09.dat  Updated

 - PART 3 Generate SQL
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-01'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '30.6', '493.877', '2015-09-01' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-02'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '26.8', '494.145', '2015-09-02' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-03'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '28.2', '494.427', '2015-09-03' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-04'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '31.7', '494.744', '2015-09-04' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-05'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '36.4', '495.108', '2015-09-05' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-06'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '34.1', '495.449', '2015-09-06' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-07'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '30', '495.749', '2015-09-07' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-08'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '23.9', '495.988', '2015-09-08' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-09'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '26.5', '496.253', '2015-09-09' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-10'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '44.4', '496.697', '2015-09-10' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-11'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '36.2', '497.059', '2015-09-11' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-12'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '14.9', '497.208', '2015-09-12' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-13'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '51.3', '497.721', '2015-09-13' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-14'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '24.6', '497.967', '2015-09-14' );
DELETE FROM `Meter_Calendar` WHERE devicerowid=888 and date = '2015-09-15'; INSE                                                                                                                               RT INTO `Meter_Calendar` VALUES ('888', '35', '498.317', '2015-09-15' );
update DeviceStatus set lastupdate = '2015-09-15 14:16:37' where id = 888;

 - PART 4 Update the db

File size is NOT zero ->  DB update needed
 Stoping Domoticz !
 Domoticz stopped
Update DB START
Update Values
Update Status
Update DB END
 Starting Domoticz !
2015-09-16 14:16:50.828  Domoticz V2.3011 (c)2012-2015 GizMoCuz
2015-09-16 14:16:50.830  Build Hash: 765fe41, Date: 2015-09-13 08:04:58
2015-09-16 14:16:50.831  System: Raspberry Pi
2015-09-16 14:16:50.833  Startup Path: /home/pi/domoticz/
domoticz: Domoticz is starting up....
 Domoticz started

 ### END ###


voila toute les info que j ai :oops:
sirus
Messages : 131
Inscription : 05 mai 2015, 18:09
Contact :

Re: [TUTO] Consomation d'eau ajout simple dans domoticz

Message par sirus »

Tu le lance bien avec root?

888 c'est bien le bon numero?
Raspberry B+ & PI2 / Domoticz / RFXtrx433E / multiple homemade devices
My blog/tutos for domoticz / electronics stuff : domotique.web2diz.net
atlantis007
Messages : 65
Inscription : 11 janv. 2015, 22:31
Localisation : biarritz (64)

Re: [TUTO] Consomation d'eau ajout simple dans domoticz

Message par atlantis007 »

oui je suis en root et 888 est le bon numéro de plus quand je lance le script la date et l'heure sont modifié
sirus
Messages : 131
Inscription : 05 mai 2015, 18:09
Contact :

Re: [TUTO] Consomation d'eau ajout simple dans domoticz

Message par sirus »

Bizarre... il n'y a vraiment rien sur les 3 graphe de ton compteur ??
Tu peux essayer sur le mois passé comme ca pour voir :

Code : Tout sélectionner

/home/pi/EAU/updateConsoEau.sh 2015 08

Ensuite tu peux aussi essayer ceci :

- faire un backup de la db domoticz via l'interface web (juste au cas ou)
- arrêter domoticz :

Code : Tout sélectionner

root> sudo /etc/init.d/domoticz.sh stop
- ouvrir la base de données avec sqlite3 :

Code : Tout sélectionner

root> sqlite3 /home/pi/domoticz.db
ensuite exécuter le fichier sql manuellement :

Code : Tout sélectionner

sqlite> .read /home/pi/EAU/previous.generated.2015-08.sql
Normalement, si tout vas bien il n'y a pas de message d'erreur. Mais en cas d’erreur tu devrais avoir des informations...
Colle les erreurs ici si il y en a..

ensuite tu quites sqlite3 et redémarres domoticz :

Code : Tout sélectionner

sqlite> .quit
root>sudo /etc/init.d/domoticz.sh start
Colles les erreurs ici si il y en a..
Raspberry B+ & PI2 / Domoticz / RFXtrx433E / multiple homemade devices
My blog/tutos for domoticz / electronics stuff : domotique.web2diz.net
Répondre