Expand description
§smgw-lmn
Read meters on the Local Metrological Network into a bounded smgw_core::taf15::Profile. Every importer runs without an allocator or OS. It binds each value to the commissioned meter and register, keeps the exact decimal value, and changes nothing when it rejects an answer.
| Protocol | Feature | Entry point | Typical meter |
|---|---|---|---|
| DLMS/COSEM | acquisition (default) | dlms::read_profile over your dlms::AttributeReader | Electricity meters with a Profile Generic buffer |
| SML | sml | sml::read_profile_pack, sml::capture_reading | German electricity meters (mME, eHZ) |
| Wireless M-Bus / OMS | mbus | mbus::capture_telegram | Gas meters |
Each module re-exports its codec as protocol: dlms-cosem-kit, sml-kit and mbus-kit with OMS security.
§Trust rules
- DLMS/COSEM checks capture definitions, period and scaler on both sides of the buffer read.
- SML profile rows need a calendar timestamp inside the requested range. Push readings use the gateway’s clock through
Slot. - OMS accepts only telegrams whose MAC (mode 7) or CCM tag (mode 10) verified. Mode 5 and ELL encryption are rejected, because they hide a reading without protecting it. The host stores the returned
Accepted::counterwith the history and passes it back aslast_counter, so a replay is rejected.
For a blocking DLMS client, wrap the commissioned transport in BudgetedTransport and pass the client and result scratch to BlockingReader::new. Set the I/O deadline on the transport. On error, check requires_reconnect() before retrying. Reader API
§Run the examples
From the workspace root:
cargo run --locked -p smgw-lmn --features simulator --example dlms_backfill
cargo run --locked -p smgw-lmn --features simulator --example sml_backfill
cargo run --locked -p smgw-lmn --features mbus --example oms_gasThe two backfill examples fill a missing quarter-hour, count duplicates and reject a conflicting reread. oms_gas accepts the published OMS Annex N mode 7 telegram and rejects a replay, a mode 5 telegram and a tampered frame. Load profile guide
§Meter and gateway roles
mme owns the register and its local observations. The simulator connects that meter to the gateway over loopback TCP with simulator::Protocol::Dlms or Protocol::Sml. Each session lasts at most four seconds, and an SML frame holds at most 1 KiB.
| Build | Cargo features | Responsibility |
|---|---|---|
| Embedded gateway | acquisition, sml, mbus | Validate meter answers and import them into the gateway’s TAF 15 profile. |
smgw-sim | loopback-client | Read the commissioned profile. DLMS commits after the meter confirms release, SML after one complete answer frame. |
mme-sim | default-features = false, loopback-meter | Serve a read-only snapshot of the virtual meter over either protocol. |
| Examples | simulator | Exercise both roles in one process. |
Run cargo run --locked -p mme-sim -- --protocol sml --interactive to advance an SML meter independently of the gateway. Stateful meter walkthrough
Licensed under MIT OR Apache-2.0.
Modules§
- dlms
- Read a clock-selected COSEM Profile Generic buffer into a bounded TAF 15 history.
- mbus
- Import an authenticated wireless M-Bus (OMS) gas meter telegram into a TAF 15 history.
- simulator
- Loopback meter and gateway roles for the commissioned simulation channel, over DLMS/COSEM or SML.
- sml
- Import SML (Smart Message Language) readings into a bounded TAF 15 history.