Pas de lecture des trames teleinfo

Salut,

J’essaye de configurer le plugon Jeedom teleinfo avec mon modem USB cartelectronic v2 DIN (Jeedom sous RPi 3).
J’ai suivi la documentation mais visiblement le démon ne semble pas lancer la lecture des données sur le modem car la LED ne clignote pas ce qu’elle fait quand je fais un test de lecture sous Windows en reconfigurant le modem en mode W.

Le modem est bien visible dans les périph USB:

 lsusb
Bus 001 Device 005: ID 174c:1153 ASMedia Technology Inc. ASM1153 SATA 3Gb/s bridge
Bus 001 Device 018: ID 0463:ffff MGE UPS Systems UPS
Bus 001 Device 031: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Et d’ailleurs bien visible du plugin:

Le diag est ok:

Je vois qu’il y a bien un process qui tourne sur mon Jeedom :

ps -ef|grep teleinfo
www-data  4177     1  7 20:05 ?        00:00:01 /usr/bin/python3 /var/www/html/plugins/teleinfo/ressources/teleinfo.py --type conso --port /dev/ttyUSB0 --vitesse 1200 --apikey xQRvx73Qw3v313WyxTgRNN90dJPhNjMkrTvWChObBY77r1vVPDavvsMrQw0BRY9r --mode historique --socketport 55062 --cycle 0.3 --callback http://127.0.0.1:81/plugins/teleinfo/core/php/jeeTeleinfo.php --loglevel debug --cyclesommeil 0.5

Par contre personne n’écoute sur le port 55062:

netstat -an|grep 55062
root@jeedom4:/var/log#

La seule chose que je vois dans les logs ce sont des erreurs lors de l’arrêt du démon mais rien au lancement (fichier joint).
teleinfo_deamon_conso.txt (5,5 Ko)

Est-ce que vous auriez une idée svp ?

Un grand merci d’avance !

Bonjour
Passez le niveau de log en mode debug, sauvegardez et relancer le demon.
Postez ensuite ici le résultat des log entre balises </>

Dams

Bonjour,
Merci de votre aide :wink:

En fait j’étais déjà en mode DEBUG (mode debug forcé demporaire) mais pas beaucoup de trace.
Au lancement j’ai uniquement ça:

[2023-08-07 20:27:26][INFO] : GLOBAL------Start teleinfod
[2023-08-07 20:27:26][INFO] : GLOBAL------Cycle Sommeil : 0.5
[2023-08-07 20:27:26][INFO] : GLOBAL------Socket port : 55062
[2023-08-07 20:27:26][INFO] : GLOBAL------Socket host : 127.0.0.1
[2023-08-07 20:27:26][INFO] : GLOBAL------Log level : debug
[2023-08-07 20:27:26][INFO] : GLOBAL------Callback : http://127.0.0.1:81/plugins/teleinfo/core/php/jeeTeleinfo.php
[2023-08-07 20:27:26][INFO] : GLOBAL------Vitesse : 1200
[2023-08-07 20:27:26][INFO] : GLOBAL------Apikey : 
[2023-08-07 20:27:26][INFO] : GLOBAL------Cycle : 0.3
[2023-08-07 20:27:26][INFO] : GLOBAL------Port : /dev/ttyUSB0
[2023-08-07 20:27:26][INFO] : GLOBAL------Type : conso
[2023-08-07 20:27:26][INFO] : GLOBAL------Mode : historique
[2023-08-07 20:27:26][DEBUG] : Writing PID 14043 to /tmp/jeedom/teleinfo/teleinfo_conso.pid
[2023-08-07 20:27:26][DEBUG] : Init request module v2.21.0
[2023-08-07 20:27:26][DEBUG] : Starting new HTTP connection (1): 127.0.0.1:81

Et quand je stoppe le démon:

[2023-08-07 20:27:26][INFO] : GLOBAL------Start teleinfod
[2023-08-07 20:27:26][INFO] : GLOBAL------Cycle Sommeil : 0.5
[2023-08-07 20:27:26][INFO] : GLOBAL------Socket port : 55062
[2023-08-07 20:27:26][INFO] : GLOBAL------Socket host : 127.0.0.1
[2023-08-07 20:27:26][INFO] : GLOBAL------Log level : debug
[2023-08-07 20:27:26][INFO] : GLOBAL------Callback : http://127.0.0.1:81/plugins/teleinfo/core/php/jeeTeleinfo.php
[2023-08-07 20:27:26][INFO] : GLOBAL------Vitesse : 1200
[2023-08-07 20:27:26][INFO] : GLOBAL------Apikey : 
[2023-08-07 20:27:26][INFO] : GLOBAL------Cycle : 0.3
[2023-08-07 20:27:26][INFO] : GLOBAL------Port : /dev/ttyUSB0
[2023-08-07 20:27:26][INFO] : GLOBAL------Type : conso
[2023-08-07 20:27:26][INFO] : GLOBAL------Mode : historique
[2023-08-07 20:27:26][DEBUG] : Writing PID 14043 to /tmp/jeedom/teleinfo/teleinfo_conso.pid
[2023-08-07 20:27:26][DEBUG] : Init request module v2.21.0
[2023-08-07 20:27:26][DEBUG] : Starting new HTTP connection (1): 127.0.0.1:81
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.7/http/client.py", line 1260, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1030, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 970, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 181, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x75cd4a50>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=81): Max retries exceeded with url: /plugins/teleinfo/core/php/jeeTeleinfo.php?apikey= (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x75cd4a50>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/www/html/plugins/teleinfo/ressources/jeedom/jeedom.py", line 134, in test
    response = requests.get(self.url + '?apikey=' + self.apikey, verify=False)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=81): Max retries exceeded with url: /plugins/teleinfo/core/php/jeeTeleinfo.php?apikey= (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x75cd4a50>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/www/html/plugins/teleinfo/ressources/teleinfo.py", line 815, in <module>
    if not globals.JEEDOM_COM.test():
  File "/var/www/html/plugins/teleinfo/ressources/jeedom/jeedom.py", line 140, in test
    logging.error('Callback result as a unknown error: %s. Please check your network configuration page'% (e.message,))
AttributeError: 'ConnectionError' object has no attribute 'message'
[2023-08-07 20:30:20][DEBUG] : Signal 15 caught, exiting...
[2023-08-07 20:30:20][INFO] : GLOBAL------Shutdown
[2023-08-07 20:30:20][INFO] : Removing PID file /tmp/jeedom/teleinfo/teleinfo_conso.pid
[2023-08-07 20:30:20][DEBUG] : Exit 0

En fait je m’aperçoit que personne n’écoute sur le port 81 alors que le démon est sensé se binder dessus de ce que je comprends:

 ps -ef|grep tele
www-data 17000     1  1 20:32 ?        00:00:01 /usr/bin/python3 /var/www/html/plugins/teleinfo/ressources/teleinfo.py --type conso --port /dev/ttyUSB0 --vitesse 1200 --apikey [supprime] --mode historique --socketport 55062 --cycle 0.3 --callback http://127.0.0.1:81/plugins/teleinfo/core/php/jeeTeleinfo.php --loglevel debug --cyclesommeil 0.5
root     17366 32554  0 20:33 pts/0    00:00:00 grep tele
root@jeedom4:/var/log# netstat -an|grep 81
unix  2      [ ]         DGRAM                    19481
unix  2      [ ]         DGRAM                    14811

Le problème à l’arrêt et juste un effet de bord je suppose du fait que personne n’écoute sur ce port.

Je ne vois pas l’équipement dans vos ports usb
essayer de faire

ls -l /dev/serial/by-id

Dams

ls -l /dev/serial/by-id
total 0
lrwxrwxrwx 1 root root 13 août   7 19:46 usb-Cartelectronic_Interface_USB_1_TIC_DA8C95JD-if00-port0 -> ../../ttyUSB0

ok c’est donc bon
Pouvez vous relancer les dépendances et mettre le log de l’installation

Dams

Je ne suis pas sûr de l’endroit ou retrouver les logs du module teleinfo.
Dans Analyse|Logs sur teleinfo j’ai ça après avoir relancé l’installation des dépendances:

[2023-08-07 20:39:05][DEBUG] : calculatepapp 
[2023-08-07 20:40:05][INFO] : ----- Calcul des statistiques temps réel -----
[2023-08-07 20:40:05][INFO] : Date de début : 2023-08-07 00:00:00
[2023-08-07 20:40:05][INFO] : Date de fin   : 2023-08-07 20:40:05
[2023-08-07 20:40:05][INFO] : Liste index HP            : EASF02,EASF04,EASF06,HCHP,BBRHPJB,BBRHPJW,BBRHPJR,EJPHPM
[2023-08-07 20:40:05][INFO] : Liste index HC            : EASF01,EASF03,EASF05,HCHC,BBRHCJB,BBRHCJW,BBRHCJR,EJPHN
[2023-08-07 20:40:05][INFO] : Liste index Production    : EAIT
[2023-08-07 20:40:05][INFO] : Liste index Conso Totale  : BASE,EAST,HCHP,HCHC,BBRHPJB,BBRHPJW,BBRHPJR,BBRHCJB,BBRHCJW,BBRHCJR,EJPHPM,EJPHN
[2023-08-07 20:40:05][INFO] : ----------------------------------------------
[2023-08-07 20:40:05][DEBUG] : calculatepapp 

normalement il dois y avoir un nouveau log à côté de l’autre dans log et surveillance

Dams

le teleinfo package

Dams

Celui là est vide même après avoir relancé l’installation ce qui m’étonne du coup

oui c’est pas normal
Passer le log en haut en mode debug et sauvegarder
Essayez de redémarrer le demon de nouveau et de mettre en gestion automatique

Dams

Passe aussi le plugin en version bêta c’est beaucoup plus logique au niveau des logs, il n’y a plus ce mode debug forcé temporaire

Je suis passé sur la béta.
Dans les logs du plugin j’ai ça:

[2023-08-07 21:51:15][INFO] : [TELEINFO_deamon] état global => retour: ok
[2023-08-07 21:51:18][DEBUG] : [TELEINFO_deamon_infoserial] test pid
[2023-08-07 21:51:18][DEBUG] : [TELEINFO_deamon_infoserial] pidfile = conso ou 2cpt
[2023-08-07 21:51:18][DEBUG] : [TELEINFO_deamon_modem] état : ok
[2023-08-07 21:51:18][DEBUG] : [TELEINFO_deamon_MQTT] état : sans
[2023-08-07 21:51:18][DEBUG] : [TELEINFO_deamon_prod] état : sans
[2023-08-07 21:51:18][INFO] : [TELEINFO_deamon] état global => retour: ok

Au fait quand je clique sur « configuration auto » ça échoue et il me dit de configurer la vitesse manuellement.
Je suppose que le démon ne fonctionne pas correctement et que ça vient de là ?

Je crois que la vitesse dépend du type de comptage dans le linky historique ou standard voir doc https://nextdom.github.io/plugin-teleinfo/fr_FR/?theme=dark

Dams

Là dans tes logs ça te dit que le demon associé au modem fonctionne. Qu’est ce qui ne fonctionne pas?

Tu peux passer les logs en mode debug ça cause un peu plus

Cette partie ne fonctionne pas. Il faut que tu saches si ton compteur est en mode historique ou standard. Lorsque tu l’a fait fonctionner avec windows, tu avais un champs ADSC. (mode historique = 1200 bauds) ou ADCO (mode standard = 9600 bauds)

une fois en fonction un équipement va se créer automatiquement

Dams

Ok.
Mon compteur est en mode historique. J’ai vérifié la TIC indiquée dessus.

Sinon j’ai compris pour mon problème initial: le démon accède aux APIs de Jeedom or je n’autorise pas l’accès HTTP sur mon Jeedom à la base mais uniquement un accès en TLS mutuel.
En ajoutant un hôte virtuel en HTTP sur le port 81 le démon se connecte bien au modem et je vois à présent la LED de télétransmission clignoter :grinning:. ça avance !

Par contre pour l’instant je ne vois toujours aucun compteur se créer.
Voici les derniers logs du démon:


[2023-08-07 22:38:57][DEBUG] : Init request module v2.21.0
[2023-08-07 22:38:57][INFO] : MODEM------Start teleinfod
[2023-08-07 22:38:57][DEBUG] : Writing PID 26620 to /tmp/jeedom/teleinfo/teleinfo_conso.pid
[2023-08-07 22:38:57][INFO] : MODEM------ Cycle Sommeil : 0.5
[2023-08-07 22:38:57][INFO] : MODEM------ Socket port : 55062
[2023-08-07 22:38:57][INFO] : MODEM------ Socket host : 127.0.0.1
[2023-08-07 22:38:57][INFO] : MODEM------ Log level : debug
[2023-08-07 22:38:57][INFO] : MODEM------ Callback : http://127.0.0.1:81/plugins/teleinfo/core/php/jeeTeleinfo.php
[2023-08-07 22:38:57][INFO] : MODEM------ Vitesse : 1200
[2023-08-07 22:38:57][INFO] : MODEM------ Apikey :
[2023-08-07 22:38:57][INFO] : MODEM------ Cycle : 0.3
[2023-08-07 22:38:57][INFO] : MODEM------ Port : /dev/ttyUSB0
[2023-08-07 22:38:57][INFO] : MODEM------ Type : conso
[2023-08-07 22:38:57][INFO] : MODEM------ Mode : standard
[2023-08-07 22:38:57][DEBUG] : Starting new HTTP connection (1): 127.0.0.1:81
[2023-08-07 22:38:57][DEBUG] : http://127.0.0.1:81 "GET /plugins/teleinfo/core/php/jeeTeleinfo.php?apikey= HTTP/1.1" 200 0
[2023-08-07 22:38:57][DEBUG] : Socket interface started
[2023-08-07 22:38:57][DEBUG] : LoopNetServer Thread started
[2023-08-07 22:38:57][INFO] : MODEM------ Start listening...
[2023-08-07 22:38:57][DEBUG] : Listening on: [127.0.0.1:55062]
[2023-08-07 22:38:57][DEBUG] : MODEM------INIT CONNECTION
[2023-08-07 22:38:57][INFO] : MODEM------ Preparing Teleinfo...
[2023-08-07 22:38:57][DEBUG] : MODEM------ Read Socket Thread Launched
[2023-08-07 22:38:57][INFO] : MODEM------ RUN
[2023-08-07 22:38:57][INFO] : MODEM------ OPEN CONNECTION
[2023-08-07 22:38:57][INFO] : MODEM------ CONNECTION OPENED