ESPHome 2026.3.0-dev
Loading...
Searching...
No Matches
obis.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5namespace esphome::dlms_meter {
6
7// Data types as per specification
8enum DataType {
9 NULL_DATA = 0x00,
10 BOOLEAN = 0x03,
11 BIT_STRING = 0x04,
18 INTEGER = 0x0F,
19 LONG = 0x10,
20 UNSIGNED = 0x11,
22 LONG64 = 0x14,
24 ENUM = 0x16,
25 FLOAT32 = 0x17,
26 FLOAT64 = 0x18,
27 DATE_TIME = 0x19,
28 DATE = 0x1A,
29 TIME = 0x1B,
30
31 ARRAY = 0x01,
32 STRUCTURE = 0x02,
33 COMPACT_ARRAY = 0x13
34};
35
36enum Medium {
37 ABSTRACT = 0x00,
40 COOLING = 0x05,
41 HEAT = 0x06,
42 GAS = 0x07,
43 COLD_WATER = 0x08,
44 HOT_WATER = 0x09,
45 OIL = 0x10,
47 NITROGEN = 0x12
48};
49
50// Data structure
51static constexpr uint8_t DECODER_START_OFFSET = 20; // Skip header, timestamp and break block
52static constexpr uint8_t OBIS_TYPE_OFFSET = 0;
53static constexpr uint8_t OBIS_LENGTH_OFFSET = 1;
54static constexpr uint8_t OBIS_CODE_OFFSET = 2;
55static constexpr uint8_t OBIS_CODE_LENGTH_STANDARD = 0x06; // 6-byte OBIS code (A.B.C.D.E.F)
56static constexpr uint8_t OBIS_CODE_LENGTH_EXTENDED = 0x0C; // 12-byte extended OBIS code
57static constexpr uint8_t OBIS_A = 0;
58static constexpr uint8_t OBIS_B = 1;
59static constexpr uint8_t OBIS_C = 2;
60static constexpr uint8_t OBIS_D = 3;
61static constexpr uint8_t OBIS_E = 4;
62static constexpr uint8_t OBIS_F = 5;
63
64// Metadata
65static constexpr uint16_t OBIS_TIMESTAMP = 0x0100;
66static constexpr uint16_t OBIS_SERIAL_NUMBER = 0x6001;
67static constexpr uint16_t OBIS_DEVICE_NAME = 0x2A00;
68
69// Voltage
70static constexpr uint16_t OBIS_VOLTAGE_L1 = 0x2007;
71static constexpr uint16_t OBIS_VOLTAGE_L2 = 0x3407;
72static constexpr uint16_t OBIS_VOLTAGE_L3 = 0x4807;
73
74// Current
75static constexpr uint16_t OBIS_CURRENT_L1 = 0x1F07;
76static constexpr uint16_t OBIS_CURRENT_L2 = 0x3307;
77static constexpr uint16_t OBIS_CURRENT_L3 = 0x4707;
78
79// Power
80static constexpr uint16_t OBIS_ACTIVE_POWER_PLUS = 0x0107;
81static constexpr uint16_t OBIS_ACTIVE_POWER_MINUS = 0x0207;
82
83// Active energy
84static constexpr uint16_t OBIS_ACTIVE_ENERGY_PLUS = 0x0108;
85static constexpr uint16_t OBIS_ACTIVE_ENERGY_MINUS = 0x0208;
86
87// Reactive energy
88static constexpr uint16_t OBIS_REACTIVE_ENERGY_PLUS = 0x0308;
89static constexpr uint16_t OBIS_REACTIVE_ENERGY_MINUS = 0x0408;
90
91// Netz NOE specific
92static constexpr uint16_t OBIS_POWER_FACTOR = 0x0D07;
93
94} // namespace esphome::dlms_meter