Loading...
Loading...
What a device accepts, and why 202 does not mean the relay closed.
POST /v1/devices/{id}/commands forwards the body to the device unchanged. We deliberately do not validate it against a per-type schema: what a board accepts is defined by its firmware, which ships independently of this API, so a whitelist here would silently block every new capability until somebody remembered to update it.
The response is 202 Accepted, not 200. It means the broker has taken the command for delivery — not that the relay has closed. To observe the result, either read the device back a moment later or take a webhook, which is pushed as soon as the device reports.
// Multi-channel hub / touch switchboard — channel index is zero-based
{ "ch": 0, "on": true }
// Everything on, in one message
{ "relays": [true, true, true, true] }
// Single-relay devices (plug, light, switch)
{ "power": true }
// Dimmable light — 0-100
{ "power": true, "brightness": 60 }
// Fan speed — 0-5
{ "speed": 3 }
// Named scene on a hub
{ "scene": "movie" }Fields a device does not understand are ignored by the firmware rather than rejected, so sending an extra key is safe. The exact fields each product accepts are listed on its page in the shop and in firmware/<type>/ in the open-source repository.