2025/12/16 - AWS IoT - 2 updated api methods
Changes Add support for dynamic payloads in IoT Device Management Commands
{'mandatoryParameters': {'type': 'STRING | INTEGER | DOUBLE | LONG | '
'UNSIGNEDLONG | BOOLEAN | BINARY',
'valueConditions': [{'comparisonOperator': 'EQUALS | '
'NOT_EQUALS '
'| '
'LESS_THAN '
'| '
'LESS_THAN_EQUALS '
'| '
'GREATER_THAN '
'| '
'GREATER_THAN_EQUALS '
'| IN_SET '
'| '
'NOT_IN_SET '
'| '
'IN_RANGE '
'| '
'NOT_IN_RANGE',
'operand': {'number': 'string',
'numberRange': {'max': 'string',
'min': 'string'},
'numbers': ['string'],
'string': 'string',
'strings': ['string']}}]},
'payloadTemplate': 'string',
'preprocessor': {'awsJsonSubstitution': {'outputFormat': 'JSON | CBOR'}}}
Creates a command. A command contains reusable configurations that can be applied before they are sent to the devices.
See also: AWS API Documentation
Request Syntax
client.create_command(
commandId='string',
namespace='AWS-IoT'|'AWS-IoT-FleetWise',
displayName='string',
description='string',
payload={
'content': b'bytes',
'contentType': 'string'
},
payloadTemplate='string',
preprocessor={
'awsJsonSubstitution': {
'outputFormat': 'JSON'|'CBOR'
}
},
mandatoryParameters=[
{
'name': 'string',
'type': 'STRING'|'INTEGER'|'DOUBLE'|'LONG'|'UNSIGNEDLONG'|'BOOLEAN'|'BINARY',
'value': {
'S': 'string',
'B': True|False,
'I': 123,
'L': 123,
'D': 123.0,
'BIN': b'bytes',
'UL': 'string'
},
'defaultValue': {
'S': 'string',
'B': True|False,
'I': 123,
'L': 123,
'D': 123.0,
'BIN': b'bytes',
'UL': 'string'
},
'valueConditions': [
{
'comparisonOperator': 'EQUALS'|'NOT_EQUALS'|'LESS_THAN'|'LESS_THAN_EQUALS'|'GREATER_THAN'|'GREATER_THAN_EQUALS'|'IN_SET'|'NOT_IN_SET'|'IN_RANGE'|'NOT_IN_RANGE',
'operand': {
'number': 'string',
'numbers': [
'string',
],
'string': 'string',
'strings': [
'string',
],
'numberRange': {
'min': 'string',
'max': 'string'
}
}
},
],
'description': 'string'
},
],
roleArn='string',
tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
string
[REQUIRED]
A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.
string
The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.
string
The user-friendly name in the console for the command. This name doesn't have to be unique. You can update the user-friendly name after you define it.
string
A short text decription of the command.
dict
The payload object for the static command.
You can upload a static payload file from your local storage that contains the instructions for the device to process. The payload file can use any format. To make sure that the device correctly interprets the payload, we recommend you to specify the payload content type.
content (bytes) --
The static payload file for the command.
contentType (string) --
The content type that specifies the format type of the payload file. This field must use a type/subtype format, such as application/json. For information about various content types, see Common MIME types.
string
The payload template for the dynamic command.
dict
Configuration that determines how payloadTemplate is processed to generate command execution payload.
awsJsonSubstitution (dict) --
Configuration for the JSON substitution preprocessor.
outputFormat (string) -- [REQUIRED]
Converts the command preprocessor result to the format defined by this parameter, before sending it to the device.
list
A list of parameters that are used by StartCommandExecution API for execution payload generation.
(dict) --
A map of key-value pairs that describe the command.
name (string) -- [REQUIRED]
The name of a specific parameter used in a command and command execution.
type (string) --
The type of the command parameter.
value (dict) --
Parameter value that overrides the default value, if set.
S (string) --
An attribute of type String. For example:
"S": "Hello"
B (boolean) --
An attribute of type Boolean. For example:
"BOOL": true
I (integer) --
An attribute of type Integer (Thirty-Two Bits).
L (integer) --
An attribute of type Long.
D (float) --
An attribute of type Double (Sixty-Four Bits).
BIN (bytes) --
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
UL (string) --
An attribute of type unsigned long.
defaultValue (dict) --
The default value used to describe the command. This is the value assumed by the parameter if no other value is assigned to it.
S (string) --
An attribute of type String. For example:
"S": "Hello"
B (boolean) --
An attribute of type Boolean. For example:
"BOOL": true
I (integer) --
An attribute of type Integer (Thirty-Two Bits).
L (integer) --
An attribute of type Long.
D (float) --
An attribute of type Double (Sixty-Four Bits).
BIN (bytes) --
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
UL (string) --
An attribute of type unsigned long.
valueConditions (list) --
The list of conditions that a command parameter value must satisfy to create a command execution.
(dict) --
A condition for the command parameter that must be evaluated to true for successful creation of a command execution.
comparisonOperator (string) -- [REQUIRED]
The comparison operator for the command parameter.
operand (dict) -- [REQUIRED]
The comparison operand for the command parameter.
number (string) --
An operand of number value type, defined as a string.
numbers (list) --
A List of operands of numerical value type, defined as strings.
(string) --
string (string) --
An operand of string value type.
strings (list) --
A List of operands of string value type.
(string) --
numberRange (dict) --
An operand of numerical range value type.
min (string) -- [REQUIRED]
The minimum value of a numerical range of a command parameter value.
max (string) -- [REQUIRED]
The maximum value of a numerical range of a command parameter value.
description (string) --
The description of the command parameter.
string
The IAM role that you must provide when using the AWS-IoT-FleetWise namespace. The role grants IoT Device Management the permission to access IoT FleetWise resources for generating the payload for the command. This field is not supported when you use the AWS-IoT namespace.
list
Name-value pairs that are used as metadata to manage a command.
(dict) --
A set of key/value pairs that are used to manage the resource.
Key (string) -- [REQUIRED]
The tag's key.
Value (string) --
The tag's value.
dict
Response Syntax
{
'commandId': 'string',
'commandArn': 'string'
}
Response Structure
(dict) --
commandId (string) --
The unique identifier for the command.
commandArn (string) --
The Amazon Resource Number (ARN) of the command. For example, arn:aws:iot:<region>:<accountid>:command/<commandId>
{'mandatoryParameters': {'type': 'STRING | INTEGER | DOUBLE | LONG | '
'UNSIGNEDLONG | BOOLEAN | BINARY',
'valueConditions': [{'comparisonOperator': 'EQUALS | '
'NOT_EQUALS '
'| '
'LESS_THAN '
'| '
'LESS_THAN_EQUALS '
'| '
'GREATER_THAN '
'| '
'GREATER_THAN_EQUALS '
'| IN_SET '
'| '
'NOT_IN_SET '
'| '
'IN_RANGE '
'| '
'NOT_IN_RANGE',
'operand': {'number': 'string',
'numberRange': {'max': 'string',
'min': 'string'},
'numbers': ['string'],
'string': 'string',
'strings': ['string']}}]},
'payloadTemplate': 'string',
'preprocessor': {'awsJsonSubstitution': {'outputFormat': 'JSON | CBOR'}}}
Gets information about the specified command.
See also: AWS API Documentation
Request Syntax
client.get_command(
commandId='string'
)
string
[REQUIRED]
The unique identifier of the command for which you want to retrieve information.
dict
Response Syntax
{
'commandId': 'string',
'commandArn': 'string',
'namespace': 'AWS-IoT'|'AWS-IoT-FleetWise',
'displayName': 'string',
'description': 'string',
'mandatoryParameters': [
{
'name': 'string',
'type': 'STRING'|'INTEGER'|'DOUBLE'|'LONG'|'UNSIGNEDLONG'|'BOOLEAN'|'BINARY',
'value': {
'S': 'string',
'B': True|False,
'I': 123,
'L': 123,
'D': 123.0,
'BIN': b'bytes',
'UL': 'string'
},
'defaultValue': {
'S': 'string',
'B': True|False,
'I': 123,
'L': 123,
'D': 123.0,
'BIN': b'bytes',
'UL': 'string'
},
'valueConditions': [
{
'comparisonOperator': 'EQUALS'|'NOT_EQUALS'|'LESS_THAN'|'LESS_THAN_EQUALS'|'GREATER_THAN'|'GREATER_THAN_EQUALS'|'IN_SET'|'NOT_IN_SET'|'IN_RANGE'|'NOT_IN_RANGE',
'operand': {
'number': 'string',
'numbers': [
'string',
],
'string': 'string',
'strings': [
'string',
],
'numberRange': {
'min': 'string',
'max': 'string'
}
}
},
],
'description': 'string'
},
],
'payload': {
'content': b'bytes',
'contentType': 'string'
},
'payloadTemplate': 'string',
'preprocessor': {
'awsJsonSubstitution': {
'outputFormat': 'JSON'|'CBOR'
}
},
'roleArn': 'string',
'createdAt': datetime(2015, 1, 1),
'lastUpdatedAt': datetime(2015, 1, 1),
'deprecated': True|False,
'pendingDeletion': True|False
}
Response Structure
(dict) --
commandId (string) --
The unique identifier of the command.
commandArn (string) --
The Amazon Resource Number (ARN) of the command. For example, arn:aws:iot:<region>:<accountid>:command/<commandId>
namespace (string) --
The namespace of the command.
displayName (string) --
The user-friendly name in the console for the command.
description (string) --
A short text description of the command.
mandatoryParameters (list) --
A list of parameters for the command created.
(dict) --
A map of key-value pairs that describe the command.
name (string) --
The name of a specific parameter used in a command and command execution.
type (string) --
The type of the command parameter.
value (dict) --
Parameter value that overrides the default value, if set.
S (string) --
An attribute of type String. For example:
"S": "Hello"
B (boolean) --
An attribute of type Boolean. For example:
"BOOL": true
I (integer) --
An attribute of type Integer (Thirty-Two Bits).
L (integer) --
An attribute of type Long.
D (float) --
An attribute of type Double (Sixty-Four Bits).
BIN (bytes) --
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
UL (string) --
An attribute of type unsigned long.
defaultValue (dict) --
The default value used to describe the command. This is the value assumed by the parameter if no other value is assigned to it.
S (string) --
An attribute of type String. For example:
"S": "Hello"
B (boolean) --
An attribute of type Boolean. For example:
"BOOL": true
I (integer) --
An attribute of type Integer (Thirty-Two Bits).
L (integer) --
An attribute of type Long.
D (float) --
An attribute of type Double (Sixty-Four Bits).
BIN (bytes) --
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
UL (string) --
An attribute of type unsigned long.
valueConditions (list) --
The list of conditions that a command parameter value must satisfy to create a command execution.
(dict) --
A condition for the command parameter that must be evaluated to true for successful creation of a command execution.
comparisonOperator (string) --
The comparison operator for the command parameter.
operand (dict) --
The comparison operand for the command parameter.
number (string) --
An operand of number value type, defined as a string.
numbers (list) --
A List of operands of numerical value type, defined as strings.
(string) --
string (string) --
An operand of string value type.
strings (list) --
A List of operands of string value type.
(string) --
numberRange (dict) --
An operand of numerical range value type.
min (string) --
The minimum value of a numerical range of a command parameter value.
max (string) --
The maximum value of a numerical range of a command parameter value.
description (string) --
The description of the command parameter.
payload (dict) --
The payload object that you provided for the command.
content (bytes) --
The static payload file for the command.
contentType (string) --
The content type that specifies the format type of the payload file. This field must use a type/subtype format, such as application/json. For information about various content types, see Common MIME types.
payloadTemplate (string) --
The payload template for the dynamic command.
preprocessor (dict) --
Configuration that determines how payloadTemplate is processed to generate command execution payload.
awsJsonSubstitution (dict) --
Configuration for the JSON substitution preprocessor.
outputFormat (string) --
Converts the command preprocessor result to the format defined by this parameter, before sending it to the device.
roleArn (string) --
The IAM role that you provided when creating the command with AWS-IoT-FleetWise as the namespace.
createdAt (datetime) --
The timestamp, when the command was created.
lastUpdatedAt (datetime) --
The timestamp, when the command was last updated.
deprecated (boolean) --
Indicates whether the command has been deprecated.
pendingDeletion (boolean) --
Indicates whether the command is being deleted.