skillfed

pysml

Python library for EDL21 smart meters using Smart Message Language (SML)

pysml v0.1.8 77.8K downloads/30d#14,488 on PyPI
Permissive license MIT Active released

What it is and what it does

pysml is a Python library that reads and decodes Smart Message Language (SML) protocol data from EDL21 smart electricity meters. It abstracts away low-level SML parsing and provides access to OBIS meter values. The library supports multiple transport mechanisms—direct serial connections, serial-over-TCP bridges, and HTTP endpoints—making it flexible for different deployment scenarios.

The package is actively used by Home Assistant's EDL21 integration and includes example code for publishing meter readings to MQTT. It depends on aiohttp, bitstring, and serialx for async HTTP, binary protocol handling, and serial communication. With MIT licensing and support for Python 3.11 through 3.14, it suits home automation, energy monitoring, and utility data collection workflows.

Use it for:

  • Read energy consumption data from EDL21 meters in Home Assistant or other home automation systems.
  • Build an MQTT bridge to publish smart meter OBIS values to a message broker for real-time monitoring.
  • Collect meter readings over serial-over-TCP links in remote or networked meter deployments.
  • Parse and log SML protocol data from HTTP-accessible meter endpoints for analytics or billing systems.
  • Integrate smart meter data into custom Python applications for demand-side energy management.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Reads and parses Smart Message Language (SML) data from EDL21 smart meters via serial ports, serial-over-TCP, or HTTP connections.

Yes, if you need to read EDL21 smart meters. The library is actively maintained, has low install friction, carries no known vulnerabilities, and is proven in Home Assistant. MIT license is unrestrictive. Main consideration: ensure your meter model and transport method are supported, and your Python environment is 3.11 or later.

Install

pysml on PyPI

pip

pip install pysml

uv

uv add pysml

poetry

poetry add pysml

Installing pysml

Before you install

Low install friction with a pure-Python wheel distribution. Actively maintained with a recent release 75 days ago. Requires Python 3.11 or later.

License in practice

MIT license permits commercial and private use with minimal restrictions—suitable for most projects.

Quickstart

pip install pysml

import pysml
# Read SML data from serial port, serial-over-TCP, or HTTP endpoint
# See examples/sml-mqtt-bridge.py for MQTT publishing pattern

Requires Python 3.11 or later; meter must be accessible via serial, serial-over-TCP, or HTTP.

Verify before relying

  • Whether aiohttp, bitstring, and serialx are stable and well-maintained for production use.
  • Performance characteristics when reading from high-frequency meter streams or concurrent connections.
  • Completeness of SML protocol support and compatibility with specific meter models.
  • Whether example code for MQTT publishing is production-ready or demonstration-only.

Package facts

License MIT (permissive)
Python support supports the current Python release (<4.0,>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 3 — aiohttp, bitstring, serialx
Maintenance actively maintained — 75 days since the last release
First released
Downloads 77,848/month — #14,488 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pysml-0.1.8-py3-none-any.whl

Programming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

EDL21 smart meter readingSML parser Pythonsmart meter data collectionOBIS value extractionserial meter communicationsmart message languageenergy meter integration
smart-meterenergy-monitoringiot-integration

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

dlms-cosem

A Python library for implementing DLMS/COSEM…

permissive · top 15,000 on PyPI

dsmr-parser

Parses Dutch Smart Meter Requirements (DSMR)…

permissive · top 15,000 on PyPI

pysma

Connects to SMA solar inverters via their…

permissive · top 15,000 on PyPI

pydiscovergy

Asynchronous Python client for querying…

permissive · top 15,000 on PyPI

p1monitor

Asynchronous Python client library for reading…

permissive · top 15,000 on PyPI

pysmappee

Wrapper library for the Smappee energy…

permissive · top 15,000 on PyPI

python-homewizard-energy

Asyncio client library for communicating with…

permissive · top 15,000 on PyPI

ovoenergy

A Python client library for querying energy…

permissive · top 15,000 on PyPI

HATasmota

Parses and constructs Tasmota MQTT messages,…

permissive · top 15,000 on PyPI

pymysensors

Python API for communicating with MySensors…

permissive · top 15,000 on PyPI