03_lwt_presence

Example of the component iotmertech/iotmer v0.2.1
# 03_lwt_presence

MQTT retained presence + LWT on `{workspace_slug}/{device_key}/presence`.

## Enable

```c
iotmer_config_t cfg = IOTMER_CONFIG_DEFAULT();
cfg.presence_lwt_enable = true;

iotmer_client_t client;
iotmer_init(&client, &cfg);
iotmer_connect(&client);
```

## Payload

| Event | JSON |
|-------|------|
| Connect | `{"status":"online","ts":<unix\|0>}` |
| Unexpected disconnect (LWT) | `{"status":"offline","ts":0}` |

## Build

```bash
idf.py set-target esp32
idf.py build flash monitor
```

Configure Wi‑Fi via menuconfig or `sdkconfig.defaults`.

To create a project from this example, run:

idf.py create-project-from-example "iotmertech/iotmer=0.2.1:03_lwt_presence"

or download archive (~2.10 KB)