Receive custom operation via smart rest through thin edge

Hello cumulicity community!

What product/components do you use and which version/fix level are you on?

smartrest 2.0 (mqtt / static templates), cumulocity platform 1011.0.12, thin edge latest

Is your question related to the free trail, or to a production (customer) instance?

customer instance

What are you trying to achieve? Please describe in detail.

We are developing a service to communicate with the thin edge and using smart rest for the communication. The static mqtt templates give us the option to use e.g. c8y_Command as an operation to send an information through our thin edge to our service. After some tests we found out that using c8y_Command as an operation is not entirely good if we use the c8y_Command for more than one communication line. The documentation states that the message Ids 501, 502 and 503 influence the last c8y_Command with a previous status. So a pending status of one c8y_command is set to executing via 501. But if we have multiple c8y_Commands, they can mess up the handling of these status.

Is it possible to create a custom operation which is able to communicate over smartrest 2.0 with our thin edge?

greetings and thanks in advance


Could you please elaborate on this a bit more?
With c8y_Command you can also send multiple commands separate by a newline character, if this would help in your situation.

Correct. This is the mechanism of smartrest so that e.g. 501,c8y_Command message would always set the oldest c8y_Command operation in state PENDING to EXECUTING. This expects that the client is processing each device-operation in sequence.

Regards Kai

1 Like

Adding to @Kai_Sieben, there is the possibility to add own operations. You can define the MQTT messages via SmartRest Templates:


1 Like


thank you for your answers.

What was meant here specifically was that with multiple different c8y_Commands the order for setting the status can be not securely be followed. Also our customer wants to use a custom operation, so that it is seperated from the standard available operations.

For this reason we need custom operations so we can set the status separately.

Thank you for the reference of this tutorial. We added the custom smart rest template to our thin edge. As we tested the mqtt connection with a local mqtt client we discovered that it recognized the message id we entered. We also subscribed to the topics mentioned in the tutorial in our service.


Additionally we used the Analytics Builder to test the smartrest template. When we use c8y_Command as operation in the Analytics Builder messages are sent to the thin edge and are received by our service. But it seems we have problems to get our smartrest template to send data to our thin edge. Can you please tell us what are we missing here:


1 Like

You have not check marked that you want to include an response and probably also not defined an response template:

You basically need to define a template and what the condition is that allows the sending of that (so basically you operation name in the condition)

1 Like

Thank you very much, the condition and the pattern was exactly what we needed to know.