# `Grizzly.Events`
[🔗](https://github.com/smartrent/grizzly/blob/v9.1.4/lib/grizzly/events.ex#L1)

Pubsub registry for Grizzly events other than Z-Wave commands from devices.

## Events

### Ready
This event is emitted when Z/IP Gateway has started and Grizzly is ready to
process commands.

### OTW Firmware Update
This event is emitted when updating the firmware on the Z-Wave module. The
payload indicates the status. See `t:Grizzly.FirmwareUpdates.OTWUpdateRunner.update_status/0`.

### Serial API Status
This event is emitted when the serial API appears to be unresponsive (or recovers
from this state) based on Z/IP Gateway's log output.

# `event`

```elixir
@type event() :: :ready | :otw_firmware_update | :serial_api_status
```

# `subject`

```elixir
@type subject() ::
  event() | Grizzly.command() | Grizzly.node_id() | {:node, Grizzly.node_id()}
```

# `subscribe_opt`

```elixir
@type subscribe_opt() :: {:firehose, boolean()}
```

# `subscribe_opts`

```elixir
@type subscribe_opts() :: [subscribe_opt()]
```

# `subscriptions`

```elixir
@type subscriptions() :: [
  event: [event()],
  commands: [Grizzly.command()],
  nodes: [Grizzly.node_id()]
]
```

# `child_spec`

```elixir
@spec child_spec(any()) :: Supervisor.child_spec()
```

# `subscribe`

```elixir
@spec subscribe(subject() | [subject()], subscribe_opts()) :: :ok
```

Subscribe to an event, all commands from a node, or a specific command from any
node.

## Options

* `:firehose` - Normally, subscribers will only receive unsolicited commands
  from the node (or command) they are subscribed to. If this option is set to
  true, subscribers will receive all incoming commands that match, including
  responses to commands sent via `Grizzly.send_command/4`. Defaults to `false`.

# `subscriptions`

```elixir
@spec subscriptions(GenServer.server()) :: subscriptions()
```

List a process's subscriptions.

# `unsubscribe`

```elixir
@spec unsubscribe(subject() | [subject()]) :: :ok
```

Unsubscribe from one or more Grizzly events.

---

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