Send commands IoT
Deep dive into Kamea IoT commands mechanism.
3 min
3 min
4 min
3 min
3 min
3 min
3 min
3 min
5 min
In fleet management, communication between the cloud and the IoT device relies on channels that can be either unidirectional or bidirectional.
A unidirectional channel, such as HTTP, requires the device to initiate the request and close the connection once the response is received, which prevents any spontaneous push from the cloud. In contrast, a bidirectional channel, such as MQTT or Azure IoT Hub, maintains a persistent connection and enables downlink; the cloud can push information to the device in real time.
This mechanism makes it possible to send IoT commands and, more broadly, actions controlled directly from the IoT platform.
What is a command?
A command is essentially a Remote Procedure Call (RPC) executed on the device. Its purpose is to trigger an action synchronously, meaning the cloud waits for an immediate response.
This characteristic fundamentally distinguishes an IoT command from a configuration, which is processed asynchronously by the device: the instruction is sent, the connected device handles it according to its logic and constraints and later reports its properties.
With a command, Kamea remains in the same transaction until the device responds. If the response does not arrive within the expected time, the call is considered a failure. This approach is ideal for punctual actions such as an immediate reboot, activating an actuator (e.g., closing blinds), or starting a temporary debug session that opens an SSH connection only for the required duration.
Why IoT commands matter
- Immediate responsiveness: Trigger critical actions without delay to ensure operational continuity.
- Reduced physical interventions: Avoid costly on-site visits by performing remote actions (e.g., reboot, debug).
- Faster support resolution: Start a diagnostic session instantly to troubleshoot issues without waiting.
- Operational reliability: Get synchronous feedback confirming success or failure for quick decision-making.
- Technical flexibility: Leverage bidirectional channels for diverse scenarios (maintenance, automation, security).
Why synchronicity is key
Commands are designed for immediate and critical operations, where the outcome must be known instantly to drive subsequent actions. It’s not about “reboot when you can,” but reboot now or fail.
This semantic requirement is essential for use cases where the system must make rapid decisions: if the device is offline, the failure must be reported clearly so that monitoring or automation can react accordingly.
Channel support
Command support depends on the communication channel.
On Azure IoT Hub, Kamea uses cloud-to-device methods, which natively provide the expected RPC behavior.
With MQTT and Kamea platform’s implementation, commands use codified and documented topics to ensure RPC-like semantics, with correlated publish and response.
Conversely, HTTP, being a unidirectional channel, cannot support real-time command execution. This limitation arises because the server cannot synchronously push instructions to devices, given that most devices do not expose an HTTP server with a public IP address.
The general policy is straightforward:
- If the channel is unidirectional, you cannot send commands IoT.
- If the channel is bidirectional, commands are supported either through the channel’s native mechanism or via Kamea’s implementation that reproduces RPC behavior.
Command structure
Each IoT command includes a name, an optional payload in JSON format, and a timeout.
The name specifies the action, for example, reboot. The payload carries any required parameters, such as credentials for “start a debug session.” The timeout defines the maximum wait time for the device’s response; beyond this, the call explicitly fails.
Given the synchronous nature of IoT commands, the expected execution time is measured in seconds or minutes, not hours or days. The goal is not to launch a long-running operation but to trigger and validate a short, immediate action on the device.
Conclusion
IoT commands in Kamea enable real-time actions on devices using bidirectional channels. They guarantee synchronous execution, immediate feedback, and seamless integration with Azure IoT Hub’s native mechanisms or Kamea’s MQTT implementation.
This capability is particularly suited for critical and punctual operations, where the IoT platform must instantly know whether the action succeeded or failed to properly drive the next steps.

