I have a microservice which creates a custom operation for a device. The devices subscribes via MQTT to the topic s/ds. As I understand as long as I have no response template defined, the operation is not available on this topic.
Now I created a SmartRest Response Template like this:
11,599,c8y_Info,c8y_Info.expireDate
Still no message arriving on the topic. What am I missing?
For built-in operations like c8y_Command
you don’t need Response templates and can just subscribe on s/ds
.
For any other custom fragment you need to define a response template and need to subscribe to s/dc/<template-id>
See here: SmartREST 2.0 - Cumulocity documentation
Yes, for built-in that works.
For the custom one: So I would need to subscribe to s/dc/599 given my example above?
Unfortunately this is not working. If I subscribe to devicecontrol/notifications I receive it.
Is 599 the ID of your template collection? (Also called X-ID
)
You stated you’re in a Microservice and you’re not using thin-edge. Nevertheless, the thin-edge docs here are giving an example on how to create a smart rest template in order to receive a custom operation (in this case under s/dc/custom_devmgmt
). Maybe that reference helps.
599
is probably the msg-id but not the template-id as Korbinian commented already.
Check the DM UI to find out the ID of your template:
In my screen above
ID: test
Perfect, thank you! I indeed used the wrong ID.