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-fast
  • 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-fast
  • 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.4.0.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.4.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyteleinfo-0.4.0.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.4.0.tar.gz
Algorithm Hash digest
SHA256 b8a231d158f8fbd3c5ac132305c6ba10a25319658cf5e5736f840131d6467bf1
MD5 e999ddc18474f9122fbcc09cfb3b4de9
BLAKE2b-256 09695f2b1d737ba51ab4f181aea356996e0c416ed24134d59bf31d673beb8528

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyteleinfo-0.4.0-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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44f785f3123550446552ccb99ce81ec4d6443ad1b93e6c304102e87765ae3d79
MD5 d987cafd3122536ed475ba46c6370a1a
BLAKE2b-256 e7d0958fb79e416f8dd7ee7ca7467dc69cabfd053e2249a0acaca71150c65559

See more details on using hashes here.

Provenance

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