DSMR.OBIS (DSMR v1.0.0)
View SourceCentralized OBIS code mapping for DSMR telegrams.
This module is the single source of truth for OBIS code mappings. The parser (src/dsmr_parser.yrl) calls this module directly at runtime.
Summary
Functions
Returns all field-to-OBIS mappings as a map.
Returns the ordered list of telegram fields for serialization.
Returns the field name for a given OBIS code list.
Returns the OBIS code string for a given telegram field.
Functions
Returns all field-to-OBIS mappings as a map.
@spec field_order() :: [atom()]
Returns the ordered list of telegram fields for serialization.
The order matches the DSMR specification and is used when converting a Telegram struct to its string representation.
Examples
iex> fields = DSMR.OBIS.field_order()
iex> hd(fields)
:version
iex> :electricity_delivered_1 in fields
true
@spec get_field([non_neg_integer()]) :: atom() | nil
Returns the field name for a given OBIS code list.
Used by the parser to map OBIS codes to struct fields. This function is called from Erlang code in dsmr_parser.yrl.
Examples
iex> DSMR.OBIS.get_field([1, 3, 0, 2, 8])
:version
iex> DSMR.OBIS.get_field([1, 0, 1, 8, 1])
:electricity_delivered_1
iex> DSMR.OBIS.get_field([99, 99, 99, 99, 99])
nil
Returns the OBIS code string for a given telegram field.
Used by serialization logic (Telegram.to_string/1).
Examples
iex> DSMR.OBIS.get_obis(:version)
"1-3:0.2.8"
iex> DSMR.OBIS.get_obis(:electricity_delivered_1)
"1-0:1.8.1"