Skip to main content

No project description provided

Project description

pyteleinfo

A Python library for decoding and encoding ENEDIS teleinfo frames - implementation of the tele-information communication frames specifications for French electronic electricity meters.

PyPI version License Python Versions

Features

  • Decode teleinfo frames from French ENEDIS electricity meters
  • Encode data back to teleinfo format
  • Read frames from serial port with configurable settings
  • Async I/O support with pyserial-asyncio
  • Comprehensive exception handling
  • Pydantic-based settings with environment variable support

Installation

pip install pyteleinfo

Quick Start

Decoding Teleinfo Frames

from teleinfo import decode

# Decode a raw teleinfo frame (bytes or string)
raw_frame = b'\x02\nADCO 050022120078 2\r\nOPTARIF HC.. <\r\x03'
decoded = decode(raw_frame)
print(decoded)
# [{'label': 'ADCO', 'data': '050022120078'}, {'label': 'OPTARIF', 'data': 'HC..'}]

Reading from a Serial Port

from teleinfo import read_frame, decode

# Read a complete frame from the serial port
raw = read_frame("/dev/ttyUSB0")
decoded = decode(raw)
print(decoded)

Settings can be customized via the TeleinfoSettings class or environment variables (prefixed with TELEINFO_, e.g. TELEINFO_BAUDRATE=1200):

from teleinfo.settings import TeleinfoSettings

settings = TeleinfoSettings(baudrate=9600, timeout=10.0)
raw = read_frame("/dev/ttyUSB0", settings=settings)

Requirements

  • Python >= 3.12
  • pyserial >= 3.5
  • pyserial-asyncio >= 0.6
  • pydantic-settings >= 2.13.1

Development

# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone and setup
git clone https://github.com/esciara/pyteleinfo.git
cd pyteleinfo
uv sync --group dev

# Run tests
uv run pytest

# Lint and format
uv run ruff check .
uv run ruff format .

# Type checking
uv run mypy src

License

BSD 3-Clause License - Copyright (c) 2019 Emmanuel Sciara

See LICENSE file for details.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyteleinfo-0.3.0.tar.gz (107.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyteleinfo-0.3.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file pyteleinfo-0.3.0.tar.gz.

File metadata

  • Download URL: pyteleinfo-0.3.0.tar.gz
  • Upload date:
  • Size: 107.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyteleinfo-0.3.0.tar.gz
Algorithm Hash digest
SHA256 79aedf770ce222d99b72f03a388af9995777df7f71044b083548bfd15191edf3
MD5 be2ac59bad59f58c968f222b059e59db
BLAKE2b-256 65c99a1190a2c817537d1e12cc77c6981be81cf76da576acae561d1e3b899a1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyteleinfo-0.3.0.tar.gz:

Publisher: publish.yml on esciara/pyteleinfo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyteleinfo-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyteleinfo-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyteleinfo-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 328fbc1c1d248209f4852ccf1cc1c137210fb04ff65c19fcd568079864c2d56a
MD5 5e974127f4bef374f8342cd979dd319a
BLAKE2b-256 ef9d37e5f3d20458bdbf0ec4e59ae5e1bd8eb9352d6447e43c0762165b5ed461

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyteleinfo-0.3.0-py3-none-any.whl:

Publisher: publish.yml on esciara/pyteleinfo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page