TL;DR
Subscribe to
/tenants/{tenant_id}/devices/{device_id}/actions
to receive actions and publish the reponse to
/tenants/{tenant_id}/devices/{device_id}/action/status
in JSON array format.Introduction
To trigger an action from the cloud follow the guides on Creating new Action Types and Triggering an Action. Let us assume an action calledprint
has been created that prints the payload:

Receiving Action
Actions or commands can be received from Bytebeam by subscribing to the actions MQTT topic:{tenant_id}
with your project name and {device_id}
with the device id.
A device should only subscribe to the topic with tenant it is connected.
_Device will be disconnected if device connected to tenant
_Device will be disconnected if device connected to tenant
demo
, tries to subscribe to topic with other tenant, say mytenant
,
e.g. /tenants/mytenant/devices/1/actions
id
: An unique identifier generated for this event which will be used to ack back.name
: Name of the action that is triggeredpayload
: Optional payload that is provided while triggering the action
Responding to Action with Action Status
We need to send a response back to the cloud to indicate progress of executing the command. This response must be published to:id
: Must be a string and the sameid
which was received with actiontimestamp
: Timestamp in millisecondsstate
: can be any text to indicuate current status. e.g. A long running commands, like OTA, might have multiple states “Downloading”, “Updating ECU 1”, “Updating ECU 2” so on so forth as statuses.
"Failed"
and "Completed"
are special terminal states that indicate that the action is completeerrors
: is an array of strings and is looked at only if thestate
is sent as"Failed"
. The UI displays these errors. e.g.["File not found"]
progress
: Percentage in range 0 to 100 indicating progress within a given state. e.g. ifstate
is “Downloading” andprogress
is 50 it means 50% of Downlaod is complete.
progress
is ignored if state
is "Completed"
or "Failed"
For long running actions, periodically send the action status.Sending action status as
"Received"
to notify the server that the action is received is optional but a good practice.
Send "Completed"
or "Failed"
status at the end of the action.Receiving actions using MQTTX
Open MQTTX and click on the+ New Subscription
button:







kind
. That field has been deprecated.
You can send progress back as shown below:

demo
and device id 2
to your tenant and device id
You should now be able to see the action as completed on the UI
