Read teleinfo from France EDF 🇫🇷 electricty provider. 🔌
A lib used to read teleinformation from electric meter. Basically, the I1 and I2 port provide a serial signal with some usefull informations. Tested only with ESP8266, but should work with other boards using MicroPython.
You can below find an exemple with UART immediatly reconfigured and re-attached to REPL after data record.
Exemple on ESP8266:
from utime import sleep
from machine import UART
from teleinfo import Teleinfo
ti_uart = UART(0) # Some board have many UART, use UART0 for ESP8266
telei = Teleinfo(ti_uart)
try :
print('Detach REPL, see you soon')
sleep(3)
dupterm(None, 1) # Detach REPL from UART
t = telei.get_next_trame() # Configure REPL for telemetry and record data
finally : # make sure that REPL is re-attached if something would go wrong
ti_uart.init(baudrate=115200, parity=None, bits=8, stop=1) #reinit uart with default value
dupterm(ti_uart, 1) # Re-attach REPL
print('REPL reattached')
print(t.infos_dict['BASE']) # Print index
if you don't care about REPL :
from utime import sleep
from machine import UART
from teleinfo import Teleinfo
ti_uart = UART(0) # Some board have many UART, use UART 0 for ESP8266
telei = Teleinfo(ti_uart)
while True:
trame = telei.get_next_trame()
for k, v in t.infos_dict.items():
# to some stuff, like MQTT post
sleep(30)
Not tested with ESP32, should be work with UART1 or UART2
See https://www.magdiblog.fr/gpio/teleinfo-edf-suivi-conso-de-votre-compteur-electrique/ for all labels definition
Schema from : http://hallard.me/pitinfov12/
ℹ️ With linky meter, I had to change the value of R1 resistor 4,7kΩ --> 1kΩ to make it work.
🚧 Add checksum control