DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
mbus.h File Reference

Wired M-Bus (Meter-Bus, EN 13757-2/-3) frame codec (DETWS_ENABLE_MBUS). More...

#include "ServerConfig.h"

Go to the source code of this file.

Detailed Description

Wired M-Bus (Meter-Bus, EN 13757-2/-3) frame codec (DETWS_ENABLE_MBUS).

A pure, zero-heap builder + parser for the M-Bus link-layer frames used by utility meters (water / gas / heat / electricity), plus a walker for the EN 13757-3 variable-data records (DIF / VIF). M-Bus has three frame formats:

single char : E5 (ACK)
short frame : 10 C A CS 16
long frame : 68 L L 68 C A CI [user data] CS 16 (L = 3 + data; CS = sum(C..data) mod 256)

The control frame is just a long frame with no user data (L = 3). The checksum is the 8-bit sum of every octet from C through the end of the user data.

The wired bus is a powered two-wire pair: the ESP32 talks to it over a UART through an M-Bus level converter (e.g. a TSS721-based master module). This codec is the framing + record layer; the UART transport is the application's. Bridge meters onto Wi-Fi by polling REQ_UD2 and publishing the decoded records.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file mbus.h.