# `Sml.Units`
[🔗](https://github.com/emischorr/sml_ex/blob/v0.1.0/lib/sml/units.ex#L1)

DLMS/COSEM unit codes (IEC 62056-62) as used in the `unit` field of SML
list entries.

The most common ones for electricity meters are `27` (W), `30` (Wh),
`33` (A), `35` (V) and `44` (Hz).

    iex> Sml.Units.name(30)
    :wh

    iex> Sml.Units.symbol(27)
    "W"

    iex> Sml.Units.code(:wh)
    30

# `code`

```elixir
@type code() :: 0..255
```

# `code`

```elixir
@spec code(atom()) :: code() | nil
```

Returns the unit code for a unit name, or `nil` if it is unknown.

# `name`

```elixir
@spec name(code() | nil) :: atom() | nil
```

Returns the unit name for a unit code, or `nil` if it is unknown.

# `symbol`

```elixir
@spec symbol(code() | nil) :: String.t() | nil
```

Returns the unit symbol for a unit code, or `nil` if it is unknown.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
