Device Commands - IoT Lens

Device Commands

When you are building an IoT application, you need the ability to interact with your device through commands remotely. An example in the industrial vertical is to use remote commands to request specific data from a piece of equipment. An example usage in the smart home vertical is to use remote commands to schedule an alarm system remotely.

With AWS IoT Core, you can implement commands using MQTT topics, or the AWS IoT Device Shadow, to send commands to a device and receive an acknowledgment when a device has executed the command. Use the Device Shadow over MQTT topics for implementing commands. The Device Shadow has several benefits over using standard MQTT topics, such as a clientToken, to track the origin of a request, version numbers for managing conflict resolution, and the ability to store commands in the cloud in the event that a device is offline and unable to receive the command when it is issued. The device’s shadow is commonly used in cases where a command needs to be persisted in the cloud even if the device is currently not online. When the device is back online, the device requests the latest shadow information and executes the command.

Figure 3: Using a message broker to send commands to a device.