Comme annoncé, ce forum est passé en lecture seule au 1er janvier 2020. Désormais nous vous invitons à vous rendre sur notre nouvelle page communauté :
Image

A très bientôt !

[Plugin Tiers] Plugin Téléinfo

Pour échanger sur les plugins classés en catégorie "Energie"
palouf34
Timide
Messages : 280
Inscription : 27 oct. 2016, 18:40
Localisation : saint-junien
Contact :

Re: [Plugin Tiers] Plugin Téléinfo

Message par palouf34 » 20 avr. 2018, 11:03

alors passe le à 1200
Microserver GEN8 VM jeedom ( Conso,ballon d'eau chaude)
Jeedom Raspi3 (Teleinfo,z-wave)

kevinpato
Timide
Messages : 106
Inscription : 31 mai 2015, 17:00
Localisation : Ancenis

Re: [Plugin Tiers] Plugin Téléinfo

Message par kevinpato » 20 avr. 2018, 11:06

Déjà testé, c'était mon 1er test, et ça ne donne rien de plus malheureusement :(
Jeedom 3.3.19 sur Rpi 3 + Debian Stretch
Téléinfo + Z-Wave + Xiaomihome

palouf34
Timide
Messages : 280
Inscription : 27 oct. 2016, 18:40
Localisation : saint-junien
Contact :

Re: [Plugin Tiers] Plugin Téléinfo

Message par palouf34 » 20 avr. 2018, 11:17

et dans le log du plugin tu a quoi?
passe le en mode debug.
Microserver GEN8 VM jeedom ( Conso,ballon d'eau chaude)
Jeedom Raspi3 (Teleinfo,z-wave)

kevinpato
Timide
Messages : 106
Inscription : 31 mai 2015, 17:00
Localisation : Ancenis

Re: [Plugin Tiers] Plugin Téléinfo

Message par kevinpato » 20 avr. 2018, 11:34

Je suis déjà en debug, j'avais mis le contenu dans un message précédent mais je peux le redonner :

A 9600 :

Code : Tout sélectionner

[2018-04-20 11:30:39][INFO] : Vérification de l'état du service : NOK
[2018-04-20 11:30:39][INFO] : Démarrage compteur de consommation
[2018-04-20 11:30:39][INFO] : --------- Informations sur le master --------
[2018-04-20 11:30:39][INFO] : Adresse             :http://192.168.1.30:80
[2018-04-20 11:30:39][INFO] : Host / Port         :192.168.1.30:80
[2018-04-20 11:30:39][INFO] : Path complémentaire :
[2018-04-20 11:30:39][INFO] : Mise en forme pour le service : http://192.168.1.30:80
[2018-04-20 11:30:39][INFO] : Debug : 0
[2018-04-20 11:30:39][INFO] : Force : 0
[2018-04-20 11:30:39][INFO] : Port modem : /dev/ttyUSB0
[2018-04-20 11:30:39][INFO] : Type : conso
[2018-04-20 11:30:39][INFO] : ---------------------------------------------
[2018-04-20 11:30:39][INFO] : Fonctionnement en mode 1 compteur
[2018-04-20 11:30:39][INFO] : Exécution du service : nice -n 19 /usr/bin/python /var/www/html/plugins/teleinfo/ressources/teleinfo.py -d 0 -p /dev/ttyUSB0 -v 9600 -e http://192.168.1.30:80 -c 26bb52klq8jh5tyujnph -f 0 -t conso -r /var/www/html/plugins/teleinfo/core/class
Traceback (most recent call last):
File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 405, in <module>
teleinfo.run()
File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 262, in run
self.open()
File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 130, in open
raise TeleinfoException(error)
NameError: global name 'error' is not defined
[2018-04-20 11:30:41][INFO] : Vérification de l'état du service : NOK
[2018-04-20 11:30:52][INFO] : Vérification de l'état du service : NOK
[2018-04-20 11:30:52][ERROR] : Impossible de lancer le démon téléinfo, vérifiez l'ip

A 1200 :

Code : Tout sélectionner

[2018-04-20 11:34:08][INFO] : Vérification de l'état du service : NOK
[2018-04-20 11:34:08][INFO] : Démarrage compteur de consommation
[2018-04-20 11:34:08][INFO] : --------- Informations sur le master --------
[2018-04-20 11:34:08][INFO] : Adresse             :http://192.168.1.30:80
[2018-04-20 11:34:08][INFO] : Host / Port         :192.168.1.30:80
[2018-04-20 11:34:08][INFO] : Path complémentaire :
[2018-04-20 11:34:08][INFO] : Mise en forme pour le service : http://192.168.1.30:80
[2018-04-20 11:34:08][INFO] : Debug : 0
[2018-04-20 11:34:08][INFO] : Force : 0
[2018-04-20 11:34:08][INFO] : Port modem : /dev/ttyUSB0
[2018-04-20 11:34:08][INFO] : Type : conso
[2018-04-20 11:34:08][INFO] : ---------------------------------------------
[2018-04-20 11:34:08][INFO] : Fonctionnement en mode 1 compteur
[2018-04-20 11:34:08][INFO] : Exécution du service : nice -n 19 /usr/bin/python /var/www/html/plugins/teleinfo/ressources/teleinfo.py -d 0 -p /dev/ttyUSB0 -v 1200 -e http://192.168.1.30:80 -c 26bb52klq8jh5tyujnph -f 0 -t conso -r /var/www/html/plugins/teleinfo/core/class
Traceback (most recent call last):
File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 405, in <module>
teleinfo.run()
File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 262, in run
self.open()
File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 130, in open
raise TeleinfoException(error)
NameError: global name 'error' is not defined
[2018-04-20 11:34:10][INFO] : Vérification de l'état du service : NOK
[2018-04-20 11:34:18][DEBUG] : Pas de calcul
[2018-04-20 11:34:20][INFO] : Vérification de l'état du service : NOK
[2018-04-20 11:34:20][ERROR] : Impossible de lancer le démon téléinfo, vérifiez l'ip
Log du démon :

Code : Tout sélectionner

2018-04-20 11:30:40,708 INFO Try to open Teleinfo modem /dev/ttyUSB0 with speed 9600
2018-04-20 11:30:40,709 ERROR Error opening Teleinfo modem /dev/ttyUSB0 : Traceback (most recent call last):
File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 123, in open
self._ser = serial.Serial(self._device, self._vitesse, bytesize=7, parity = E, stopbits=1)
AttributeError: module object has no attribute Serial
2018-04-20 11:34:09,232 INFO Try to open Teleinfo modem /dev/ttyUSB0 with speed 1200
2018-04-20 11:34:09,233 ERROR Error opening Teleinfo modem /dev/ttyUSB0 : Traceback (most recent call last):
File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 123, in open
self._ser = serial.Serial(self._device, self._vitesse, bytesize=7, parity = E, stopbits=1)
AttributeError: module object has no attribute Serial
Jeedom 3.3.19 sur Rpi 3 + Debian Stretch
Téléinfo + Z-Wave + Xiaomihome

palouf34
Timide
Messages : 280
Inscription : 27 oct. 2016, 18:40
Localisation : saint-junien
Contact :

Re: [Plugin Tiers] Plugin Téléinfo

Message par palouf34 » 20 avr. 2018, 11:47

tu peux me dire ce que contient le fichier

Code : Tout sélectionner

/var/www/html/plugins/teleinfo/ressources/teleinfo.py"

je pense que l'erreur viens de la.
Microserver GEN8 VM jeedom ( Conso,ballon d'eau chaude)
Jeedom Raspi3 (Teleinfo,z-wave)

kevinpato
Timide
Messages : 106
Inscription : 31 mai 2015, 17:00
Localisation : Ancenis

Re: [Plugin Tiers] Plugin Téléinfo

Message par kevinpato » 20 avr. 2018, 11:53

C'est un fichier propre au plugin téléinfo... Ce n'est pas moi qui ai développé cela :)

Voici le contenu cependant :

Code : Tout sélectionner

#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

""" Read one teleinfo frame and output the frame in CSV format on stdout
"""

import serial
import os
import time
import traceback
import logging
import sys
from optparse import OptionParser
from datetime import datetime
import subprocess
import urllib2
import threading
import signal

# Default log level
gLogLevel = logging.DEBUG

# Device name
gDeviceName = '/dev/ttyUSB0'
# Default output is stdout
gOutput = sys.__stdout__
gExternalIP = ''
gCleAPI = ''
gDebug = ''
gRealPath = ''
gVitesse = ''
gMessageTemp = ''
gCanStart = 'true'
# ----------------------------------------------------------------------------
# LOGGING
# ----------------------------------------------------------------------------
class MyLogger:
    """ Our own logger """
    def __init__(self):
        program_path = os.path.dirname(os.path.realpath(__file__))
        self._logger = logging.getLogger('teleinfo')
        hdlr = logging.FileHandler(program_path + '/../../../log/teleinfo_deamon')
        formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
        hdlr.setFormatter(formatter)
        self._logger.addHandler(hdlr)
        self._logger.setLevel(gLogLevel)

    def debug(self, text):
        try:
            self._logger.debug(text)
        except NameError:
            pass

    def info(self, text):
        try:
            text = text.replace("'", "")
            self._logger.info(text)
        except NameError:
            pass

    def warning(self, text):
        try:
            text = text.replace("'", "")
            self._logger.warn(text)
        except NameError:
            pass

    def error(self, text):
        try:
            text = text.replace("'", "")
            self._logger.error(text)
        except NameError:
            pass


# ----------------------------------------------------------------------------
# Exception
# ----------------------------------------------------------------------------
class TeleinfoException(Exception):
    """
    Teleinfo exception
    """

    def __init__(self, value):
        Exception.__init__(self)
        self.value = value

    def __str__(self):
        return repr(self.value)


# ----------------------------------------------------------------------------
# Teleinfo core
# ----------------------------------------------------------------------------
class Teleinfo:
    """ Fetch teleinformation datas and call user callback
    each time all data are collected
    """

    def __init__(self, device, externalip, cleapi, debug, realpath, vitesse):
        """ @param device : teleinfo modem device path
        @param log : log instance
        @param callback : method to call each time all data are collected
        The datas will be passed using a dictionnary
        """
        self._log = MyLogger()
        self._device = device
        self._externalip = externalip
        self._cleAPI = cleapi
        self._debug = debug
        self._realpath = realpath
        self._vitesse = vitesse
        self._ser = None
        #self._stop = Event()

    def open(self):
        """ open teleinfo modem device
        """
        try:
            self._log.info("Try to open Teleinfo modem '%s' with speed '%s'" % (self._device, self._vitesse))
            # if(self.vitesse == '9600'):
            self._ser = serial.Serial(self._device, self._vitesse, bytesize=7, parity = 'E', stopbits=1)
            # else:
                # self._ser = serial.Serial(self._device, 1200, bytesize=7, parity = 'E', stopbits=1)
            self._log.info("Teleinfo modem successfully opened")
        except:
            #error = "Error opening Teleinfo modem '%s' : %s" % (self._device, traceback.format_exc())
            self._log.error("Error opening Teleinfo modem '%s' : %s" % (self._device, traceback.format_exc()))
            raise TeleinfoException(error)

    def close(self):
        """ close telinfo modem
        """
        self._log.info("Try to close Teleinfo modem")
        #self._stop.set()
        if self._ser != None  and self._ser.isOpen():
            self._ser.close()
            self._log.info("Teleinfo modem successfully closed")

    def terminate(self):
        print "Terminating..."
        self.close()
        #sys.close(gOutput)
        sys.exit()

    def read(self):
        """ Fetch one full frame for serial port
        If some part of the frame is corrupted,
        it waits until th enext one, so if you have corruption issue,
        this method can take time but it enures that the frame returned is valid
        @return frame : list of dict {name, value, checksum}
        """
        #Get the begin of the frame, markde by \x02
        resp = self._ser.readline()
        is_ok = False
        #frame = []
        #frameCsv = []
        Content = {}
        while not is_ok:
            try:
                while '\x02' not in resp:
                    resp = self._ser.readline()
                #\x02 is in the last line of a frame, so go until the next one
                #print "* Begin frame"
                resp = self._ser.readline()
                #A new frame starts
                #\x03 is the end of the frame
                while '\x03' not in resp:
                    #Don't use strip() here because the checksum can be ' '
                    if len(resp.replace('\r','').replace('\n','').split()) == 2:
                        #The checksum char is ' '
                        name, value = resp.replace('\r','').replace('\n','').split()
                        checksum = ' '
                    else:
                        name, value, checksum = resp.replace('\r','').replace('\n','').split()
                        #print "name : %s, value : %s, checksum : %s" % (name, value, checksum)
                    if self._is_valid(resp, checksum):
                        #frame.append({"name" : name, "value" : value, "checksum" : checksum})
                        #frameCsv.append(value)
                        Content[name] = value;
                    else:
                        self._log.error("** FRAME CORRUPTED !")
                        #This frame is corrupted, we need to wait until the next one
                        #frame = []
                        #frameCsv = []
                        while '\x02' not in resp:
                            resp = self._ser.readline()
                        self._log.error("* New frame after corrupted")
                    resp = self._ser.readline()
                #\x03 has been detected, that's the last line of the frame
                if len(resp.replace('\r','').replace('\n','').split()) == 2:
                    #print "* End frame"
                    #The checksum char is ' '
                    name, value = resp.replace('\r','').replace('\n','').replace('\x02','').replace('\x03','').split()
                    checksum = ' '
                else:
                    name, value, checksum = resp.replace('\r','').replace('\n','').replace('\x02','').replace('\x03','').split()
                if self._is_valid(resp, checksum):
                    #frame.append({"name" : name, "value" : value, "checksum" : checksum})
                    #frameCsv.append(value)
                    #print "* End frame, is valid : %s" % frame
                    is_ok = True
                else:
                    self._log.error("** Last frame invalid")
                    resp = self._ser.readline()
            except ValueError:
                #Badly formatted frame
                #This frame is corrupted, we need to wait until the next one
                #frame = []
                #frameCsv = []
                while '\x02' not in resp:
                    resp = self._ser.readline()
        #self._log.info(Content)
        return Content

    def _is_valid(self, frame, checksum):
        """ Check if a frame is valid
        @param frame : the full frame
        @param checksum : the frame checksum
        """
        #print "Check checksum : f = %s, chk = %s" % (frame, checksum)
        datas = ' '.join(frame.split()[0:2])
        my_sum = 0
        for cks in datas:
            my_sum = my_sum + ord(cks)
        computed_checksum = ( my_sum & int("111111", 2) ) + 0x20
        #print "computed_checksum = %s" % chr(computed_checksum)
        return chr(computed_checksum) == checksum

    def run(self):
        """ Main function
        """
        Donnees = {}
        _Donnees = {}
        _RAZ = datetime.now()
        _RazCalcul = 0
        _Separateur = " "
        _SendData = ""
        #global gMessageTemp

        def target():
            self.process = None
            self.process = subprocess.Popen(self.cmd + _SendData, shell=True)
            self.process.communicate()
            self.timer.cancel()

        def timer_callback():
            #logger.debug("Thread timeout, terminate it")
            if self.process.poll() is None:
                try:
                    self.process.kill()
                except OSError as error:
                    #logger.error("Error: %s " % error)
                    self._log.error("Error: %s " % error)
                self._log.warning("Thread terminated")
            else:
                self._log.warning("Thread not alive")

        # Open Teleinfo modem
        try:
            self.open()
        except TeleinfoException as err:
            self._log.error(err.value)
            self.terminate()
            return
        # Read a frame
        while(1):
            _RazCalcul = datetime.now() - _RAZ
            if(_RazCalcul.seconds > 60):
                _RAZ = datetime.now()
                for cle, valeur in Donnees.items():
                    Donnees.pop(cle)
                    _Donnees.pop(cle)
            _SendData = ""
            frameCsv = self.read()
            for cle, valeur in frameCsv.items():
                if(cle == 'PTEC'):
                    valeur = valeur.replace(".","")
                    valeur = valeur.replace(")","")
                    Donnees[cle] = valeur
                elif(cle == 'OPTARIF'):
                    valeur = valeur.replace(".","")
                    valeur = valeur.replace(")","")
                    Donnees[cle] = valeur
                else:
                    Donnees[cle] = valeur
            if(self._externalip != ""):
                self.cmd = "curl -L -s -G --max-time 15 " + self._externalip +"/plugins/teleinfo/core/php/jeeTeleinfo.php -d 'api=" + self._cleAPI
                _Separateur = "&"
            else:
                self.cmd = 'nice -n 19 timeout 15 /usr/bin/php ' + self._realpath + '/../php/jeeTeleinfo.php api=' + self._cleAPI
                _Separateur = " "

            for cle, valeur in Donnees.items():
                if(cle in _Donnees):
                    if (Donnees[cle] != _Donnees[cle]):
                        _SendData += _Separateur + cle +'='+ valeur
                        _Donnees[cle] = valeur
                else:
                    _SendData += _Separateur + cle +'='+ valeur
                    _Donnees[cle] = valeur

            if (_SendData != ""):
                _SendData += _Separateur + "ADCO=" + Donnees["ADCO"]
                if(self._externalip != ""):
                    try:
                        _SendData += "'"
                        if (self._debug == '1'):
                            print self.cmd + _SendData
                            self._log.debug(self.cmd + _SendData)
                        thread = threading.Thread(target=target)
                        self.timer = threading.Timer(int(5), timer_callback)
                        self.timer.start()
                        thread.start()
                    except Exception, e:
                        errorCom = "Connection error '%s'" % e
                else:
                    try:
                        if (self._debug == '1'):
                            print self.cmd + _SendData
                            self._log.debug(self.cmd + _SendData)
                        thread = threading.Thread(target=target)
                        self.timer = threading.Timer(int(5), timer_callback)
                        self.timer.start()
                        thread.start()
                    except Exception, e:
                        errorCom = "Connection error '%s'" % e
        self.terminate()
    def exit_handler(self, *args):
        self.terminate()
        self._log.info("[exit_handler]")

#------------------------------------------------------------------------------
# MAIN
#------------------------------------------------------------------------------
if __name__ == "__main__":
    usage = "usage: %prog [options]"
    parser = OptionParser(usage)
    parser.add_option("-o", "--output", dest="filename", help="append result in FILENAME")
    parser.add_option("-p", "--port", dest="port", help="port du modem")
    parser.add_option("-e", "--externalip", dest="externalip", help="ip de jeedom")
    parser.add_option("-c", "--cleapi", dest="cleapi", help="cle api de jeedom")
    parser.add_option("-d", "--debug", dest="debug", help="mode debug")
    parser.add_option("-r", "--realpath", dest="realpath", help="path usr")
    parser.add_option("-v", "--vitesse", dest="vitesse", help="vitesse du modem")
    parser.add_option("-f", "--force", dest="force", help="forcer le lancement")
    parser.add_option("-t", "--type", dest="type", help="type du deamon")
    (options, args) = parser.parse_args()
    if options.port:
            try:
                gDeviceName = options.port
            except:
                error = "Can not change port %s" % options.port
                raise TeleinfoException(error)
    if options.externalip:
            try:
                gExternalIP = options.externalip
            except:
                error = "Can not change ip %s" % options.externalip
                raise TeleinfoException(error)
    if options.debug:
            try:
                gDebug = options.debug
            except:
                error = "Can not set debug mode %s" % options.debug
                #raise TeleinfoException(error)
    if options.cleapi:
            try:
                gCleAPI = options.cleapi
            except:
                error = "Can not change ip %s" % options.cleapi
                raise TeleinfoException(error)
    if options.realpath:
            try:
                gRealPath = options.realpath
            except:
                error = "Can not get realpath %s" % options.realpath
                raise TeleinfoException(error)
    if options.vitesse:
            try:
                gVitesse = options.vitesse
            except:
                error = "Can not get vitesse %s" % options.vitesse
                raise TeleinfoException(error)
    if options.force:
            try:
                if options.force == '0':
                    if os.path.isfile("/tmp/teleinfo_" + options.type + ".pid"):
                        filetmp = open("/tmp/teleinfo_" + options.type + ".pid", 'r')
                        filepid = filetmp.readline()
                        filetmp.close()
                        if filepid != "":
                            _log = MyLogger()
                            _log.warning('Deamon deja lance')
                            gCanStart = 'false'
            except:
                error = "Can not get file PID"
                raise TeleinfoException(error)
    if gCanStart == 'true':
        pid = str(os.getpid())
        file("/tmp/teleinfo_" + options.type + ".pid", 'w').write("%s\n" % pid)
        teleinfo = Teleinfo(gDeviceName, gExternalIP, gCleAPI, gDebug, gRealPath, gVitesse)
        signal.signal(signal.SIGTERM, teleinfo.exit_handler)
        teleinfo.run()
    sys.exit()
Jeedom 3.3.19 sur Rpi 3 + Debian Stretch
Téléinfo + Z-Wave + Xiaomihome

palouf34
Timide
Messages : 280
Inscription : 27 oct. 2016, 18:40
Localisation : saint-junien
Contact :

Re: [Plugin Tiers] Plugin Téléinfo

Message par palouf34 » 20 avr. 2018, 12:05

ton jeedom est sur un rpi ou sur une VM?
Microserver GEN8 VM jeedom ( Conso,ballon d'eau chaude)
Jeedom Raspi3 (Teleinfo,z-wave)

kevinpato
Timide
Messages : 106
Inscription : 31 mai 2015, 17:00
Localisation : Ancenis

Re: [Plugin Tiers] Plugin Téléinfo

Message par kevinpato » 20 avr. 2018, 12:19

Sur un Rpi 3
Jeedom 3.3.19 sur Rpi 3 + Debian Stretch
Téléinfo + Z-Wave + Xiaomihome

Avatar de l’utilisateur
ticed35
Actif
Messages : 1343
Inscription : 22 juil. 2014, 21:44
Localisation : Montréal

Re: [Plugin Tiers] Plugin Téléinfo

Message par ticed35 » 20 avr. 2018, 13:35

Hello,
Il n'y a pas eu de modifications importantes sur le démon entre la version 2.7 et 2.6.3, juste des suppressions de commentaires.
N'y a t'il pas eu de mise a jour du système en même temps ?
Présence / SonyBravia / Téléinfo

palouf34
Timide
Messages : 280
Inscription : 27 oct. 2016, 18:40
Localisation : saint-junien
Contact :

Re: [Plugin Tiers] Plugin Téléinfo

Message par palouf34 » 20 avr. 2018, 13:42

pour ma part je seche...

au fait la version pour supporté le linky et son mode standard avance ??
Microserver GEN8 VM jeedom ( Conso,ballon d'eau chaude)
Jeedom Raspi3 (Teleinfo,z-wave)

Avatar de l’utilisateur
ticed35
Actif
Messages : 1343
Inscription : 22 juil. 2014, 21:44
Localisation : Montréal

Re: [Plugin Tiers] Plugin Téléinfo

Message par ticed35 » 20 avr. 2018, 13:46

J'ai possiblement une piste je vais passer un hotfix au cas ou.
Pour le linky y'a eu des avancées sur l'issue, ce sera en version 3.0.0 par contre j'ai pas de date pour le moment.
Présence / SonyBravia / Téléinfo

Avatar de l’utilisateur
ticed35
Actif
Messages : 1343
Inscription : 22 juil. 2014, 21:44
Localisation : Montréal

Re: [Plugin Tiers] Plugin Téléinfo

Message par ticed35 » 20 avr. 2018, 14:19

Est-il possible de lancer l'installation des dépendances en version 2.7.1 et me donner le résultat.
Merci
Présence / SonyBravia / Téléinfo

palouf34
Timide
Messages : 280
Inscription : 27 oct. 2016, 18:40
Localisation : saint-junien
Contact :

Re: [Plugin Tiers] Plugin Téléinfo

Message par palouf34 » 20 avr. 2018, 14:33

ticed35 a écrit :
20 avr. 2018, 13:46
J'ai possiblement une piste je vais passer un hotfix au cas ou.
Pour le linky y'a eu des avancées sur l'issue, ce sera en version 3.0.0 par contre j'ai pas de date pour le moment.
ok, j’espère que cela va avancé vite car mon linky est passé en mode tic standard depuis hier...

j'ai un soucis avec mon modem que j’espère régler trés rapidement.
Microserver GEN8 VM jeedom ( Conso,ballon d'eau chaude)
Jeedom Raspi3 (Teleinfo,z-wave)

kevinpato
Timide
Messages : 106
Inscription : 31 mai 2015, 17:00
Localisation : Ancenis

Re: [Plugin Tiers] Plugin Téléinfo

Message par kevinpato » 20 avr. 2018, 17:54

Voici le résultat de l'installation des dépendances en 2.7.1

Code : Tout sélectionner

Lancement de l'installation/mise à jour des dépendances Téléinfo
Raffraichissement du système
Hit:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Hit:2 http://archive.raspberrypi.org/debian stretch InRelease
Reading package lists...
Installation de la librairie ftdi pour modem 2 compteurs
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package python-ftdi
Reading package lists...
Building dependency tree...
Reading state information...
python-ftdi1 is already the newest version (1.3-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Requirement already satisfied: pylibftdi in /usr/local/lib/python2.7/dist-packages
Installation de la librairie serial
Requirement already satisfied: serial in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: iso8601>=0.1.12 in /usr/local/lib/python2.7/dist-packages (from serial)
Requirement already satisfied: pyyaml>=3.12 in /usr/local/lib/python2.7/dist-packages (from serial)
Requirement already satisfied: future>=0.16.0 in /usr/local/lib/python2.7/dist-packages (from serial)
Mise à jour de cmdline ou inittab suivant système
Désactivation de la sortie serie vers la console
Everything is successfully installed!
Jeedom 3.3.19 sur Rpi 3 + Debian Stretch
Téléinfo + Z-Wave + Xiaomihome

StephG38
Timide
Messages : 157
Inscription : 07 août 2017, 09:11

Re: [Plugin Tiers] Plugin Téléinfo

Message par StephG38 » 21 avr. 2018, 08:30

Hello,
Pour info plus de Demon depuis la 2.7.1 !
Stéphane

Avatar de l’utilisateur
ticed35
Actif
Messages : 1343
Inscription : 22 juil. 2014, 21:44
Localisation : Montréal

Re: [Plugin Tiers] Plugin Téléinfo

Message par ticed35 » 21 avr. 2018, 16:29

Bonjour, est il possible d'avoir des logs ?

Merci

Envoyé en utilisant Tapatalk

Présence / SonyBravia / Téléinfo

Ethan Piett
Timide
Messages : 4
Inscription : 21 mars 2018, 21:22

Re: [Plugin Tiers] Plugin Téléinfo

Message par Ethan Piett » 21 avr. 2018, 17:07

Bonjour,

Petit message pour dire que j'ai le même phénomène que kevinpato avec les mêmes logs.

Idem je suis en Raspberry PI3 avec module téléinfo sur port USB.

La version de téléinfo est la 2.7.1. Les seuls plugins installés sont téléinfo, jeelink et z-wave.

Je ne sais pas si cela aide de savoir que nous sommes plusieurs avec ce phénomène.

sylvain_retz
Timide
Messages : 9
Inscription : 26 juin 2015, 20:35

Re: [Plugin Tiers] Plugin Téléinfo

Message par sylvain_retz » 21 avr. 2018, 17:13

Bonjour à tous.

Premièrement, je ne suis pas du tout expert en python/Linux donc je ne suis pas sur de la solution qui est peut être une grosse bidouille.
Si un expert peut donner son avis sur la méthode temporaire que j'ai trouvé en attendant une solution définitive des devs, je suis preneur.

Depuis hier et mes mises à jours, il semble que j'ai exactement le même problème:
- RFXCom HS
-Téléinfo HS

Ma config "simplifiée":
- Debian Stretch sous un PI3 en DIY
- Module RFXCom le module USB déporté blanc avec antenne.
- Module TéléInfo est un GCE usb noir

Erreur

Code : Tout sélectionner

[2018-04-21 16:44:43][INFO] : Exécution du service : nice -n 19 /usr/bin/python /var/www/html/plugins/teleinfo/ressources/teleinfo.py -d 0 -p /dev/ttyUSB0 -v 1200 -e http://192.168.0.30:80 -c ini380ruv6d6dumif3dt -f 0 -t conso -r /var/www/html/plugins/teleinfo/core/class
Traceback (most recent call last):
  File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 407, in <module>
    teleinfo.run()
  File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 264, in run
    self.open()
  File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 132, in open
    raise TeleinfoException(error)
NameError: global name 'error' is not defined
En regardant le log de l'installation des dépendances de la Téléinfo, j'ai eu ceci:

Code : Tout sélectionner

Lancement de l'installation/mise à jour des dépendances Téléinfo
Rafraîchissement du système
Hit:1 http://archive.raspberrypi.org/debian stretch InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Hit:3 https://deb.nodesource.com/node_8.x stretch InRelease
Reading package lists...
Installation de la librairie ftdi pour modem 2 compteurs
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package python-ftdi
Reading package lists...
Building dependency tree...
Reading state information...
python-ftdi1 is already the newest version (1.3-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Requirement already satisfied: pylibftdi in /usr/local/lib/python2.7/dist-packages
[b]Installation de la librairie serial
Collecting serial
  Using cached https://files.pythonhosted.org/packages/ba/59/904d924f6340a7d5747d3d7866eed459fabc97f98be1fff2ca25f798f550/serial-0.0.64-py2.py3-none-any.whl
Requirement already satisfied: iso8601>=0.1.12 in /usr/local/lib/python2.7/dist-packages (from serial)
Requirement already satisfied: pyyaml>=3.12 in /usr/local/lib/python2.7/dist-packages (from serial)
Requirement already satisfied: future>=0.16.0 in /usr/local/lib/python2.7/dist-packages (from serial)
Installing collected packages: serial
Successfully installed serial-0.0.64[/b]
Mise à jour de cmdline ou inittab suivant système
Désactivation de la sortie serie vers la console
Everything is successfully installed!
On voit bien Serial qui est installée. Or en cherchant sur internet, il semble que serial fasse référence à une bibliothèque de sérialisation des données distribuée directement avec python (dist-packages).
Cette libraire ne contient pas de classe "Serial"

Par compte, pyserial semble bien la librairie qui implémente la communication série et la classe "Serial"

Y'aurait-il une interaction? Il semblerait que

Code : Tout sélectionner

import serial
essai de chargé Serial depuis serial et non depuis pyserial d'ou le message indiquant qu'il ne trouve pas le module Serial.

En lançant, la désinstallation de pyserial, on voit un lien avec serial dans lesnom des répertoires

Code : Tout sélectionner

pi@Pi3Jeedom:/usr/local/lib/python2.7 $ sudo pip uninstall pyserial
Uninstalling pyserial-3.4:
  /home/pi/.local/bin/miniterm.py
  /home/pi/.local/bin/miniterm.pyc
  /home/pi/.local/lib/python2.7/site-packages/pyserial-3.4.dist-info/DESCRIPTION.rst
  /home/pi/.local/lib/python2.7/site-packages/pyserial-3.4.dist-info/INSTALLER
  /home/pi/.local/lib/python2.7/site-packages/pyserial-3.4.dist-info/METADATA
  /home/pi/.local/lib/python2.7/site-packages/pyserial-3.4.dist-info/RECORD
  /home/pi/.local/lib/python2.7/site-packages/pyserial-3.4.dist-info/WHEEL
  /home/pi/.local/lib/python2.7/site-packages/pyserial-3.4.dist-info/metadata.json
  /home/pi/.local/lib/python2.7/site-packages/pyserial-3.4.dist-info/top_level.txt
  /home/pi/.local/lib/python2.7/site-packages/serial/__init__.py
  /home/pi/.local/lib/python2.7/site-packages/serial/__init__.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/aio.py
  /home/pi/.local/lib/python2.7/site-packages/serial/aio.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/rfc2217.py
  /home/pi/.local/lib/python2.7/site-packages/serial/rfc2217.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/rs485.py
  /home/pi/.local/lib/python2.7/site-packages/serial/rs485.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/serialcli.py
  /home/pi/.local/lib/python2.7/site-packages/serial/serialcli.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/serialjava.py
  /home/pi/.local/lib/python2.7/site-packages/serial/serialjava.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/serialposix.py
  /home/pi/.local/lib/python2.7/site-packages/serial/serialposix.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/serialutil.py
  /home/pi/.local/lib/python2.7/site-packages/serial/serialutil.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/serialwin32.py
  /home/pi/.local/lib/python2.7/site-packages/serial/serialwin32.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/threaded/__init__.py
  /home/pi/.local/lib/python2.7/site-packages/serial/threaded/__init__.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/__init__.py
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/__init__.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/hexlify_codec.py
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/hexlify_codec.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports.py
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports_common.py
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports_common.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports_linux.py
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports_linux.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports_osx.py
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports_osx.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports_posix.py
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports_posix.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports_windows.py
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/list_ports_windows.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/miniterm.py
  /home/pi/.local/lib/python2.7/site-packages/serial/tools/miniterm.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/__init__.py
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/__init__.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_alt.py
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_alt.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_hwgrep.py
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_hwgrep.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_loop.py
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_loop.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_rfc2217.py
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_rfc2217.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_serve-rfc2217.py
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_serve-rfc2217.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.py
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_socket.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_spy.py
  /home/pi/.local/lib/python2.7/site-packages/serial/urlhandler/protocol_spy.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/win32.py
  /home/pi/.local/lib/python2.7/site-packages/serial/win32.pyc
Proceed (y/n)? y
  Successfully uninstalled pyserial-3.4
pi@Pi3Jeedom:/usr/local/lib/python2.7 $ 
En désinstallant serial, on voit aussi une structure proche au niveau répertoire

Code : Tout sélectionner

pi@Pi3Jeedom:/usr/local/lib/python2.7 $ sudo pip uninstall serial
Uninstalling serial-0.0.64:
  /home/pi/.local/lib/python2.7/site-packages/serial-0.0.64.dist-info/DESCRIPTION.rst
  /home/pi/.local/lib/python2.7/site-packages/serial-0.0.64.dist-info/INSTALLER
  /home/pi/.local/lib/python2.7/site-packages/serial-0.0.64.dist-info/METADATA
  /home/pi/.local/lib/python2.7/site-packages/serial-0.0.64.dist-info/RECORD
  /home/pi/.local/lib/python2.7/site-packages/serial-0.0.64.dist-info/WHEEL
  /home/pi/.local/lib/python2.7/site-packages/serial-0.0.64.dist-info/metadata.json
  /home/pi/.local/lib/python2.7/site-packages/serial-0.0.64.dist-info/top_level.txt
  /home/pi/.local/lib/python2.7/site-packages/serial/errors.py
  /home/pi/.local/lib/python2.7/site-packages/serial/errors.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/hooks.py
  /home/pi/.local/lib/python2.7/site-packages/serial/hooks.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/meta.py
  /home/pi/.local/lib/python2.7/site-packages/serial/meta.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/model.py
  /home/pi/.local/lib/python2.7/site-packages/serial/model.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/properties.py
  /home/pi/.local/lib/python2.7/site-packages/serial/properties.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/request.py
  /home/pi/.local/lib/python2.7/site-packages/serial/request.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/test.py
  /home/pi/.local/lib/python2.7/site-packages/serial/test.pyc
  /home/pi/.local/lib/python2.7/site-packages/serial/utilities.py
  /home/pi/.local/lib/python2.7/site-packages/serial/utilities.pyc
Proceed (y/n)? y
  Successfully uninstalled serial-0.0.64
pi@Pi3Jeedom:/usr/local/lib/python2.7 $ 
.

Suite à ces 2 désinstallations de libriarie, j'ai relancé que celle de pyserial:

Code : Tout sélectionner

pi@Pi3Jeedom:/usr/local/lib/python2.7 $ pip install pyserial
Collecting pyserial
  Using cached https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl
Installing collected packages: pyserial
Successfully installed pyserial-3.4
pi@Pi3Jeedom:/usr/local/lib/python2.7 $ 
En relançant les démons RFXCom et Téléinfo, cela fonctionne parfaitement!

Ma question est donc dans l'installation des dépendances du TéléInfo, n'était-il pas plus judicieux de mettre pyserial au lieu de serial?

J'ai essayé de modifier aussi le code import de téléinfo avec "from pyserial import Serial" mais sans succès (mais je ne suis pas expert alors c'était pour essayé).

En espérant avoir fait avancer la résolution du problème.

Sylvain

Avatar de l’utilisateur
ticed35
Actif
Messages : 1343
Inscription : 22 juil. 2014, 21:44
Localisation : Montréal

Re: [Plugin Tiers] Plugin Téléinfo

Message par ticed35 » 21 avr. 2018, 17:53

Salut sylvain_retz,
Excellente analyse, en effet il s'agit du souci des dépendances, je pousse un correctif au plus tôt.

Envoyé en utilisant Tapatalk

Présence / SonyBravia / Téléinfo

sylvain_retz
Timide
Messages : 9
Inscription : 26 juin 2015, 20:35

Re: [Plugin Tiers] Plugin Téléinfo

Message par sylvain_retz » 21 avr. 2018, 17:58

Super!
Merci bcp!

Répondre

Revenir vers « [Catégorie] Energie »

Qui est en ligne ?

Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 14 invités