Managing Devices
Add a device
- Devices → Add device.
- Fill in the fields:
| Field | Description |
|---|---|
| Name | Display name (e.g. Living room light) |
| Room | Associated room |
| Type | Lighting, AC, Security, … |
| Relay number | 1–16 on the ESP32 board |
| ESP32 Board Name | MQTT board name (e.g. sala) |
ESP32 Board Name appears when a relay number is set. Use lowercase letters, numbers, and
_only.
MQTT topics
With esp32_name = sala and relay_number = 3:
smarthome/sala/relay/3 → ON / OFF
Without esp32_name (legacy):
smarthome/relay/3
Toggle a device
- From the table: power button ⚡
- API:
PATCH /api/v1/devices/{id}/toggle - Status:
online= on,offline= off
Energy monitoring
In the device form:
- Energy monitoring — enable tracking
- Watt rating — approximate load (e.g. 60W LED)
- Monthly budget (kWh) — alert when budget is exceeded
ESP32 badge
The board name appears as a badge next to the device name when multiple ESP32 units are in use.
Troubleshooting
| Issue | Check |
|---|---|
| Toggle does nothing | esp32_name + MQTT broker reachability |
| State not updating | Pusher keys in server .env |
| 422 Validation | ESP32 name must be lowercase a-z, 0-9, _, - |