demikl / python-teleinfo

Read and parse teleinfo data from France EDF electricity provider
MIT License
6 stars 11 forks source link

modification et comportement #7

Open cobalt78 opened 3 years ago

cobalt78 commented 3 years ago

Bonjour, j'utilise le UTInfo2 mais une modification de hw_vendors.py a été nécessaire : def __init__(self, port="/dev/serial/by-id/usb-FTDI_FT230X_Basic_UART_TINFO-1631-if00-port0", *args, **kwargs): par def __init__(self, port="/dev/serial/by-id/usb-FTDI_FT230X_Basic_UART_TINFO-1850-if00-port0", *args, **kwargs): Est-ce une nouvelle version hardware ? modéle acheté en 2019.

Autre problème. Voivi les codes : si j'utilise le minicom sur mon raspberry 3 B+ avec la raspbian 2021 `Welcome to minicom 2.7

OPTIONS: I18n Compiled on Apr 22 2017, 09:14:19. Port /dev/ttyUSB0, 14:44:08

Press CTRL-A Z for help on special keys

H PAPP 02060 ) HHPHC A , MOTDETAT 000000 B ADCO 012345678912 G OPTARIF HC.. < ISOUSC 30 9 HCHC 005172561 ! HCHP 003460781 0 PTEC HC.. S IINST 009 IMAX 090 H PAPP 02050 ( HHPHC A , MOTDETAT 000000 B`

avec la library teleinfo : `Python 3.5.3 (default, Apr 5 2021, 09:00:41) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" for more information.

from teleinfo import Parser from teleinfo.hw_vendors import UTInfo2 ti = Parser(UTInfo2(port="/dev/ttyUSB0")) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.5/dist-packages/teleinfo/parser.py", line 17, in init self._synchro_debut_trame() File "/usr/local/lib/python3.5/dist-packages/teleinfo/parser.py", line 40, in _synchro_debut_trame while self._hw.read_char() != self.MARKER_START_FRAME: File "/usr/local/lib/python3.5/dist-packages/teleinfo/hw_vendors.py", line 60, in read_char return self._serial_port.read(1) File "/home/pi/.local/lib/python3.5/site-packages/serial/serialposix.py", line 596, in read 'device reports readiness to read but returned no data '`

ou `>>> import serial

ser = serial.Serial('/dev/ttyUSB0', 1200) ser.read() b'\x00' ser.readline() b' 005\xb1\xb739\xb25\xa0\xa6\x8d\n' ser.readline() b'H\xc3HP\xa0003\xb460\xb7\xb8\xb1\xa00\x8d\n' ser.readline() b'P\xd4\xc5\xc3\xa0H\xc3..\xa0S\x8d\n ser.readline() b'000 B\r\x03\x02\n'`