--- id: dlms-cosem version: "25.1.0" license: MIT license_treatment: permissive maintenance: active --- # dlms-cosem — A Python library for DLMS/COSEM License: permissive · Maintenance: active · Downloads: 84.2K/mo ## What it is and what it does dlms-cosem is a Python client library for the DLMS/COSEM protocol, which is the international standard for smart meter communication. It provides low-level protocol handling—APDU encoding and decoding, encryption/decryption, and session state management—so you can read and write data on energy meters. The library implements a sans-io design, meaning the protocol logic is separate from I/O, but ships with a blocking client for serial (HDLC) and TCP transports. It supports authentication methods including HLS-GMAC, LLS, and HLS-Common, as well as global ciphering for encrypted communication. You use it by composing a transport (TCP or serial), an authentication method, and a DlmsClient, then call methods like get(), set(), and action() to interact with meter attributes. The library is designed for reading invocation counters, energy consumption data, and other meter-specific attributes defined by OBIS codes. It has been tested on several real meters (Iskraemeco AM550, Itron SL7000, Hexing HXF300, and others) and is actively maintained, though it does not yet support building a full meter emulator. Use it for: - Read energy consumption data from smart meters in production networks using IDIS or DSMR standards. - Implement automated meter reading (AMR) systems that poll multiple meters over TCP or serial connections. - Develop meter integration layers for distribution service operators (DSOs) with manufacturer-specific meter configurations. - Test and debug DLMS/COSEM protocol communication with meters or test servers in development environments. - Build non-commercial research or educational tools for studying smart meter protocols and data models. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A Python library for implementing DLMS/COSEM protocol clients to read and write data on energy meters over serial or TCP connections, handling protocol state management, APDU encoding/decoding, and encryption. Yes, if you need to communicate with DLMS/COSEM meters and accept the Business Source License restrictions. The library is actively maintained, has low install friction, no known vulnerabilities, and provides a well-structured sans-io implementation. However, verify that the license permits your use case (commercial meter reading is restricted unless you contact the maintainer) and that your target meters are supported or compatible with the library's abstraction layer. ## Install pip install dlms-cosem uv add dlms-cosem poetry add dlms-cosem ## Installing dlms-cosem Before you install: Low friction installation with a pure-Python wheel and seven common dependencies. The library is actively maintained with recent releases and no known vulnerabilities, though it has been 506 days since the latest release. License in practice: Licensed under Business Source License 1.1 (not fully open source), which permits internal use, non-commercial education, and research but restricts competing commercial uses. Will eventually transition to Apache License 2.0; contact the maintainer for alternative licensing. Quickstart: pip install dlms-cosem from dlms_cosem.client import DlmsClient from dlms_cosem.io import BlockingTcpIO, TcpTransport from dlms_cosem.security import NoSecurityAuthentication tcp_io = BlockingTcpIO(host="localhost", port=4059) transport = TcpTransport(io=tcp_io, server_logical_address=1, client_logical_address=16) client = DlmsClient(transport=transport, authentication=NoSecurityAuthentication()) Requires a DLMS/COSEM-enabled meter or server accessible over TCP or serial connection; blocking I/O model means synchronous operations only. Verify before relying: - Whether the library supports all DLMS/COSEM companion standards (DSMR, IDIS, UNI/TS 11291) equally or if meter-specific quirks require custom code. - Performance characteristics and scalability limits for concurrent meter connections or high-frequency polling. - Current state of server/meter emulator support beyond the stated lack of full implementation. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 84.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dlms cosem energy meter client, smart meter protocol library, dlms apdu encoding decoding, energy meter communication, hdlc tcp meter reading, cosem protocol implementation, amr metering data collection, smart-metering, protocol-implementation, energy-data [View on SkillFed](https://skillfed.io/packages/dlms-cosem) · [View on PyPI](https://pypi.org/project/dlms-cosem/)