@Frederick_Loucks,
I just want to take a second to explain how we’re sending/receiving device commands. In our documentation, we explain that device commands are sent with the following payload:
{
"name": "the-command-name",
"payload": {
"key": "value",
"another-key": "another-value"
}
}
They can be sent via MQTT, the Losant API, or through a workflow output node. All three options, though, leverage the Losant specific topic for the MQTT broker, losant/<device-id>/command
(which you can read more about here). The payload of that command message is mutable, too.
So, after explaining this, I’ll address your points:
Do you mean a UUID for the command itself? Or are you looking for a UUID of something that already exists? If you are using a workflow to send device commands, you could create a random string or make a request to a UUID API or our Generate ID Node and include it in the payload of the command.
As I mentioned, if you are using MQTT or the workflow output node to send device commands, the Target Device ID is a part of the topic. Again, if you are using a workflow, you can add this value to the command payload by getting this value either from the workflow or with a Device: Get Node and can send the ID along in the payload of the Device Command message.
I’m interested in what you ultimately would like to see here. Are you looking for something like sending a device command from the cloud, then being able to see somewhere that that command is “Pending” until some event occurs? Currently the only difference between a Device Command message and a regular MQTT message is that we store a history of commands that can be retrieved via our API. Once you send a Device Command, that’s where our message lifecycle ends. There is currently not a method in place for us to know if the device received that command, if the device did what it was supposed to do, or if it failed. But, there is a workaround, you can have the device that received the command publish to a topic on successful receipt of a command (or upon successful completion of a task due to the receipt of a command).
All this being said, your requests today have sparked some internal conversations regarding our Device Commands and Device Command lifecycle. There are some features here that would make sending, receiving, and acting on Device Commands much easier.
Again, once I have more information on my side, I’ll be sure to keep you updated! And, once I have more information on the above, I’ll get those features in for you as well
I hope this information was helpful.
Thank you,
Heath