# `Grizzly.ZWave.CommandClasses`
[🔗](https://github.com/smartrent/grizzly/blob/v9.1.4/lib/grizzly/zwave/command_classes.ex#L1)

Utilities for encoding and decoding command classes and command class lists.

# `command_class`

```elixir
@type command_class() :: atom()
```

# `command_class_list`

```elixir
@type command_class_list() :: [
  non_secure_supported: [atom()],
  non_secure_controlled: [atom()],
  secure_supported: [atom()],
  secure_controlled: [atom()]
]
```

# `command_class_list_from_binary`

```elixir
@spec command_class_list_from_binary(binary()) :: [command_class_list()]
```

Turn the binary representation that is outlined in the Network-Protocol specs

# `command_class_list_to_binary`

```elixir
@spec command_class_list_to_binary([command_class_list()]) :: binary()
```

Turn the list of command classes into the binary representation outlined in
the Network-Protocol command class specification.

TODO: add more details

# `from_byte`

```elixir
@spec from_byte(byte()) ::
  {:ok, command_class()} | {:error, :unsupported_command_class}
```

# `merge`

```elixir
@spec merge(command_class_list(), command_class_list()) :: command_class_list()
```

Merges command class lists in a way that's more resilient to some Z/IP Gateway
bugs. The list provided in the second argument is merged into the first.

In particular, there's a Z/IP Gateway bug where it can lose track of a node's
supported command classes. If this happens while the node is failing, a Node
Info Cached Report can come back with an empty command class list. If requesting
the NIF works but the controller doesn't receive an S0/S2 Commands Supported Report
(e.g. due to interference), the secure command class lists will be empty.

# `to_byte`

```elixir
@spec to_byte(command_class()) :: byte()
```

Get the byte representation of the command class

# `valid?`

```elixir
@spec valid?(command_class()) :: boolean()
```

---

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