obis-parser
Dependency-free OBIS parser and measurement catalog for smart meters and energy gateways.
Extracts, parses, and normalizes OBIS (Object Identification System) codes (A-B:C.D.E*F) across smart meters (eHZ / mME), optical IR readouts (SML / IEC 62056-21), P1/DSMR meters, and Smart Meter Gateways (SMGW).
Features
- Zero External Dependencies: Built entirely with standard library Python (
dataclasses,enum,re,string,typing). - Universal Ingestion: Auto-detects and parses:
- Canonical strings:
1-0:1.8.0,1-0:1.8.0*255,1-1:1.7.0 - Shorthand display strings:
1.8.0,16.7.0,81.7.4(defaults to electricity A=1, channel B=0) - Bare COSEM 12-hex:
0100010800ff,0100100700ff,010001080000(F=0) - COSEM logical names with meter suffixes:
0100010800ff.1lgz0067285558.sm - Dot-separated hex:
01.00.01.08.00.FF
- Canonical strings:
- Single Domain Model (
OBIS): Everything is accessed directly on theOBISinstance (.canonical,.name,.slug,.placeholders,.decode()). - Channel & Tariff Qualifiers: Treats Channel ($B \neq 0$) and Tariff ($1 \le E < 255$) as name qualifiers on $(C, D)$ base measurements.
- 4-Variant Localization Slugs: Generates variant slugs (
base,_channel,_tariff,_channel_tariff) with placeholder maps, ready for Home Assistant, Prometheus, or UI localization. - Curated Catalog: 40 standard German electricity and gateway registers (DIN EN 62056-6-1 / DIN 43863-3) with units, device classes, state classes, and icons.
- DLMS/COSEM Value Scaling:
DLMSUnit(IEC 62056-6-2 unit codes) andOBIS.scale_value()turn raw register triples (value,scaler,unit) into values matching the catalog unit (e.g. Wh → kWh).
Installation
pip install obis-parser
or with uv:
uv add obis-parser
Quick Start
1. Basic Parsing & Properties
from obis_parser import OBIS
# Parses strings, bare-hex, dot-hex, or COSEM logical names
obis = OBIS.parse("0100010800ff")
if obis:
print(obis.canonical) # "1-0:1.8.0" (or str(obis))
print(obis.name) # "Active energy import"
print(obis.slug) # "active_energy_import"
print(obis.is_electricity) # True
print(obis.channel) # 0
print(obis.tariff) # 0
2. Multi-Meter Channels & Tariffs
# Multi-meter behind one gateway (Channel 1, Tariff 2)
obis = OBIS.parse("1-1:1.8.2")
if obis:
print(obis.canonical) # "1-1:1.8.2"
print(obis.name) # "Active energy import (Channel 1, Tariff 2)"
print(obis.slug) # "active_energy_import_channel_tariff"
print(obis.placeholders) # {"channel": "1", "tariff": "2"}
3. Full Metadata Decode (obis.decode())
obis = OBIS.parse("0100200700ff") # Voltage L1 (32.7.0)
if obis:
m = obis.decode()
print(m.name) # "Voltage L1"
print(m.unit) # "V"
print(m.device_class) # "voltage"
print(m.state_class) # "measurement"
print(m.icon) # "mdi:sine-wave"
print(m.dlms_unit) # 35 (DLMSUnit.VOLT)
4. Scaling Raw DLMS/COSEM Register Values (obis.scale_value())
DLMS/COSEM gateways (e.g. EMH CASA, Theben Conexa) report registers as value, scaler (power of ten) and unit (IEC 62056-6-2 code).
scale_value() applies 10**scaler and converts Wh/VAh/varh to the catalog's kWh/kVAh/kvarh. All other units are left in their base unit.
The unit may be passed as an int, numeric string, SI symbol, or DLMSUnit.
from obis_parser import OBIS, DLMSUnit
energy = OBIS.parse("1-0:1.8.0")
if energy:
print(energy.scale_value("12345678", -1, 30)) # 1234.5678 (kWh)
print(energy.scale_value("12345678", "-1", "30")) # 1234.5678 (string payloads)
voltage = OBIS.parse("1-0:32.7.0")
if voltage:
print(voltage.scale_value("2301", -1, DLMSUnit.VOLT)) # 230.1 (V)
If the gateway does not report a recognised unit (None, 0, "", or an unknown code), the catalog unit of the OBIS code is used as a fallback.
Cataloged energy registers passed without a unit are therefore assumed to be in Wh/VAh/varh.
Supported Registers (Catalog Overview)
| (C, D, E) | Measurement | Slug | Unit | Device Class | State Class |
|---|---|---|---|---|---|
| (1, 8) | Active energy import | active_energy_import |
kWh |
energy |
total_increasing |
| (2, 8) | Active energy export | active_energy_export |
kWh |
energy |
total_increasing |
| (3, 8) | Reactive energy import | reactive_energy_import |
kvarh |
reactive_energy |
total_increasing |
| (4, 8) | Reactive energy export | reactive_energy_export |
kvarh |
reactive_energy |
total_increasing |
| (9, 8) | Apparent energy | apparent_energy |
kVAh |
None |
total_increasing |
| (1, 7) | Active power import | active_power_import |
W |
power |
measurement |
| (2, 7) | Active power export | active_power_export |
W |
power |
measurement |
| (3, 7) | Reactive power import | reactive_power_import |
var |
reactive_power |
measurement |
| (4, 7) | Reactive power export | reactive_power_export |
var |
reactive_power |
measurement |
| (9, 7) | Apparent power | apparent_power |
VA |
apparent_power |
measurement |
| (16, 7) | Active power total (net sum) | active_power_total |
W |
power |
measurement |
| (15, 7) | Absolute active power (|P|) | absolute_active_power |
W |
power |
measurement |
| (36/56/76, 7) | Active power L1/L2/L3 (signed) | active_power_l1..3 |
W |
power |
measurement |
| (21/41/61, 7) | Active power import L1/L2/L3 (+P) | active_power_import_l1..3 |
W |
power |
measurement |
| (22/42/62, 7) | Active power export L1/L2/L3 (-P) | active_power_export_l1..3 |
W |
power |
measurement |
| (32/52/72, 7) | Voltage L1/L2/L3 | voltage_l1..3 |
V |
voltage |
measurement |
| (12, 7) | Voltage (total/RMS) | voltage |
V |
voltage |
measurement |
| (31/51/71, 7) | Current L1/L2/L3 | current_l1..3 |
A |
current |
measurement |
| (11, 7) | Current (neutral/total) | current |
A |
current |
measurement |
| (13, 7) | Power factor ($\cos \varphi$) | power_factor |
None |
power_factor |
measurement |
| (14, 7) | Frequency | frequency |
Hz |
frequency |
measurement |
| (81, 7, 0) | Phase angle | phase_angle |
° |
None |
measurement |
| (81, 7, 1/2) | Phase angle U(L2)/U(L3) to U(L1) | phase_angle_u_l2..3_l1 |
° |
None |
measurement |
| (81, 7, 4/15/26) | Phase angle L1/L2/L3 (U to I) | phase_angle_l1..3 |
° |
None |
measurement |
| (0, 2, 0) | Firmware version | firmware_version |
None |
None |
None |
| (96, 1, 0) | Meter identification / Serial | meter_identification |
None |
None |
None |
| (96, 99, 0) | RSSI (cellular signal strength, EMH CASA) | rssi |
dBm |
signal_strength |
measurement |
License
Apache 2.0. Copyright 2026 Jannick Fahlbusch.
Metadata
Release files for obis-parser 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| obis_parser-0.0.5.tar.gz | 18.9 kB | Without provenance | Details for obis_parser-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| obis_parser-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for obis_parser-0.0.5-py3-none-any.whl |
Total release size: 34.2 kB
Release files / obis_parser-0.0.5.tar.gz
| Download URL | obis_parser-0.0.5.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d4bd0c770deeed9c053ef76f0d98c7b84d96d434429ce2f601daace8bd68bb9
|
|
BLAKE2b-256 checksum How to use checksums |
8169750044a551ed4f8ca96efb47feead52dee9c691bc929504556ab6c52cdf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / obis_parser-0.0.5-py3-none-any.whl
| Download URL | obis_parser-0.0.5-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43f41bd8fe35747fd92250e3d650baf19bebc3a1df2923833b993fd8cd552788
|
|
BLAKE2b-256 checksum How to use checksums |
f68df6249f0d8f3aae828fb2525d351ed58fe734b0332000d764b28982c47f4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for obis-parser 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.