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

Lookup table for sendable Z-Wave commands.

# `builtin_commands`

# `create`

```elixir
@spec create(
  atom(),
  keyword()
) :: {:error, :unknown_command} | {:ok, Grizzly.ZWave.Command.t()}
```

# `create!`

```elixir
@spec create!(
  atom(),
  keyword()
) :: Grizzly.ZWave.Command.t()
```

# `decode`

```elixir
@spec decode(binary()) ::
  {:ok, Grizzly.ZWave.Command.t()}
  | {:error, Grizzly.ZWave.DecodeError.t() | Grizzly.ZWave.ZWaveError.t()}
```

# `format_handler_spec`

```elixir
@spec format_handler_spec(module() | Grizzly.handler_spec()) :: Grizzly.handler_spec()
```

# `handler`

```elixir
@spec handler(Grizzly.command()) :: Grizzly.handler_spec()
```

Get the handler spec for the command

# `lookup`

```elixir
@spec lookup(Grizzly.command() | binary()) :: {module(), [Grizzly.command_opt()]}
```

Look up the command module and handler options for a given command, either by
name or from its binary representation.

# `lookup`

```elixir
@spec lookup(byte(), byte()) :: {module(), [Grizzly.command_opt()]}
```

Look up the command module and handler options for a given command class byte
and command byte.

# `spec_for`

```elixir
@spec spec_for(Grizzly.command()) ::
  {:ok, Grizzly.ZWave.CommandSpec.t()} | {:error, :unknown_command}
```

Get the command spec for a given command name.

## Examples

    iex> Grizzly.ZWave.Commands.spec_for(:user_set)
    {:ok, %Grizzly.ZWave.CommandSpec{
      name: :user_set,
      command_byte: 0x05,
      command_class: :user_credential,
      default_params: [],
      module: Grizzly.ZWave.Commands.UserSet,
      encode_fun: {Grizzly.ZWave.Commands.UserSet, :encode_params},
      decode_fun: {Grizzly.ZWave.Commands.UserSet, :decode_params},
      handler: {Grizzly.Requests.Handlers.AckResponse, []},
      supports_supervision?: true
    }}

# `spec_for`

```elixir
@spec spec_for(byte(), byte()) ::
  {:ok, Grizzly.ZWave.CommandSpec.t()} | {:error, :unknown_command}
```

Get the command spec for a given command class byte and command byte.

# `spec_for!`

```elixir
@spec spec_for!(Grizzly.command()) :: Grizzly.ZWave.CommandSpec.t()
```

See `spec_for/1`.

# `spec_for!`

```elixir
@spec spec_for!(byte(), byte()) :: Grizzly.ZWave.CommandSpec.t()
```

See `spec_for/2`.

# `supports_supervision?`

```elixir
@spec supports_supervision?(Grizzly.command()) :: boolean()
```

Whether the command can be supervised (only commands that use the AckResponse
handler can be supervised).

---

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