robinvdvleuten

robinvdvleuten

DSMR - Parse Dutch Smart Meter telegrams in Elixir

I’ve been working on a library for parsing DSMR (Dutch Smart Meter Requirements) telegrams and thought it might be useful for others working with smart energy meters.

What is it?

DSMR is the protocol used by smart meters in the Netherlands, Belgium, and Luxembourg. These meters broadcast “telegrams” - structured data packets with electricity usage, gas consumption, voltage measurements, and more. The library parses these telegrams into Elixir structs.

Quick example

telegram = """
/KFM5KAIFA-METER

1-3:0.2.8(42)
0-0:1.0.0(161113205757W)
1-0:1.8.1(001581.123*kWh)
1-0:2.8.1(000000.000*kWh)
1-0:1.7.0(02.027*kW)
0-1:24.2.1(161129200000W)(00981.443*m3)
!6796
"""

{:ok, result} = DSMR.parse(telegram)

result.electricity_delivered_1
#=> %DSMR.Measurement{value: Decimal.new("1581.123"), unit: "kWh"}

result.electricity_currently_delivered
#=> %DSMR.Measurement{value: Decimal.new("2.027"), unit: "kW"}

Features

  • Supports DSMR 4.x and 5.x protocols

  • Handles three-phase connections with per-phase measurements

  • Parses MBus devices (gas, water, heat meters)

  • Uses Decimal for high-precision values (optional)

  • Built with leex/yecc for reliable parsing

  • Gracefully handles unknown OBIS codes

Try it yourself

The repository includes runnable Livebook examples at https://github.com/mijnverbruik/dsmr/tree/main/examples:

  • Connect to a DSMR meter: Full GenServer implementation that connects via TCP and visualizes real-time usage

  • Run your own “dummy” smart meter: Simulate a meter for testing without hardware

Links

The library is still relatively new, so feedback and contributions are welcome. Let me know if you run into any issues or have ideas for improvements!

Where Next?

Popular in Announcing Top

shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
jarlah
Testcontainers Testcontainers is an Elixir library that supports ExUnit tests, providing lightweight, throwaway instances of common datab...
New
fuelen
Ecto.DevLogger is an alternative logger of SQL queries in development It inlines bindings into the query, so it is easy to copy-paste lo...
New
halostatue
Enviable is a small collection of functions to make working with environment variables easier when configuring Elixir projects. It is des...
New
wingyplus
I just did a dirty hack after seeing Zoi on x.com a few hours ago. Quick Introduction The zoi_defstruct is a library to help you generat...
New
rms.mrcs
Hi there :waving_hand: Just dropping by to share PhonixLiveState, a lib I’ve just published. It’s still VERY RAW, but already in a reas...
New
Mati365
Phoenix has great tooling overall, but one thing that’s still lacking is a solid, plug-and-play integration with a modern WYSIWYG editor....
New
murrgelb
Efx is a library to define and test side effects declaratively. It is basically a very focused mocking framework, reducing implementation...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
trisolaran
Hi! :waving_hand: I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
194 10054 106
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New

We're in Beta

About us Mission Statement