SmartHome Hub Pro — Local API Reference

The Hub exposes a REST API on port 8080 for local LAN control. All endpoints require an API token obtained from the app (Settings → Developer → API Token).

Authentication

Include the token in the Authorization header:

Authorization: Bearer <your-api-token>

Endpoints

GET /api/v1/devices

Returns a list of all paired devices and their current state.

Response example:

{ "devices": [{ "id": "d001", "name": "Living Room Light", "type": "light", "state": "on", "brightness": 80 }] }

POST /api/v1/devices/{id}/control

Send a command to a specific device.

Body parameters:

ParameterTypeDescription
commandstringon, off, toggle, set_brightness, set_color
valueanyFor set_brightness: 0-100. For set_color: hex string.

GET /api/v1/hub/status

Returns Hub firmware version, uptime, and connected device count.

POST /api/v1/hub/reboot

Reboots the Hub. Requires admin token. The Hub will be unavailable for ~30 seconds.

Webhooks

Configure webhooks in Settings → Developer → Webhooks. The Hub will POST a JSON payload to your URL whenever a device state changes.

Payload format:

{ "event": "device_state_changed", "device_id": "d001", "state": "off", "timestamp": 1712345678 }

Rate Limits

Local API: 60 requests per minute per token. Exceeding this returns HTTP 429.

Cloud API: 1000 requests per day per account.