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.1.tar.gz (111.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.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyteleinfo-0.3.1.tar.gz
  • Upload date:
  • Size: 111.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.1.tar.gz
Algorithm Hash digest
SHA256 235811c3400e09cd5aad287ef46f22115e7701545d119c14f1fe1ccb81012d4f
MD5 2a9b4eb1624ac98bf684a04de3d2957f
BLAKE2b-256 1fe2d22cddd6740831cb0c01fcb562923ad54bcf68024e972f2135eccd1a25eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyteleinfo-0.3.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: pyteleinfo-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99e92ff58bf155c10f53f877a1adef6775cf82d65c6d6266e4d5faec00626043
MD5 e0c92b1057e29dfb5246dd58691c5ea6
BLAKE2b-256 7005e43420e5334e8af80bab552abf8adf793e9c7c881a46e1c0639b5bdc4593

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyteleinfo-0.3.1-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