gadgets_command
Run a capability on a connected gadget using JSON arguments, then return the final command status or a command ID for polling if the device is slow.
Instructions
Ask a gadget to run one command capability with JSON arguments.
The call waits up to 3 seconds for the device's report and returns the final status when it arrives. If command.status is still accepted or dispatched, the device is slow: poll gadgets_command_status with command.command_id instead of sending the command again.
command_id is optional. For a new action, omit it: the gateway creates a unique ID and returns it as command.command_id. Within 10 minutes and the same gateway process, repeating that ID with identical arguments returns the original receipt with duplicate=true, or stale_command_id if the receipt was evicted. It does not run again. Changed arguments return duplicate_conflict. Never reuse an ID for a new action. Retry protection is not durable: after a restart or outside that window, inspect state before acting. Do the same if a lost reply left you without a command ID. Never create a new ID to retry an uncertain action.
command.status: accepted = queued; dispatched = delivered, waiting for the device; executed / failed = the device reported a result (a report, not physical proof); not_delivered = the device never received it, so sending it again as a new action is safe; timed_out / unconfirmed = outcome unknown, so read state before acting again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arguments | Yes | ||
| device_id | Yes | ||
| capability | Yes | ||
| command_id | No |