# `Homex.Manager`
[🔗](https://github.com/kevinschweikert/homex/blob/v0.1.2/lib/homex/manager.ex#L1)

Central manager for broker and entities.

The mananger is responsible to manage the communication with the MQTT broker and keeps track of all registered entities.

# `pubopt`

```elixir
@type pubopt() :: {:retain, boolean()} | {:qos, qos() | qos_name()}
```

# `qos`

```elixir
@type qos() :: 0 | 1 | 2
```

# `qos_name`

```elixir
@type qos_name() ::
  :qos0 | :at_most_once | :qos1 | :at_least_once | :qos2 | :exactly_once
```

# `add_entities`

```elixir
@spec add_entities([atom()]) :: [atom()]
```

Adds multiple modules to the entities and updates the discovery config, so that Home Assistant also adds the entities.
Returns a list of started modules.

# `add_entity`

```elixir
@spec add_entity(atom()) :: :ok | {:error, atom()}
```

Adds a module to the entities and updates the discovery config, so that Home Assistant also adds this entity.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `connected?`

```elixir
@spec connected?() :: boolean()
```

# `publish`

```elixir
@spec publish(String.t(), binary() | map(), [pubopt()]) ::
  :ok | {:error, Jason.EncodeError.t() | Exception.t()}
```

Let's you publish additional messages to a topic

# `remove_entity`

```elixir
@spec remove_entity(atom()) :: :ok | {:error, atom()}
```

Removes a registered module from the entities and updates the discovery config, so that Home Assistant also removes this entity.

# `start_link`

---

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