Trigger custom operation via SmartRest on thinedge.io device

Product/components used and version/fix level:

thinedge.io 0.13.1
.eu-latest.cumulocity.com 1018

Detailed explanation of the problem:

I try to run a custom operation on my device running thinedge.io.

Therfore i created a SmartRest Template:

I tested it with MQTT-Box and the template works, i get the MQTT-Message on “s/dc/greenhousewebcam” (541,mqtt-test2,51886804,5) when posting a coresponding opereation via rest.

But it does not work for thinedge.
I created a file “c8y_Startstream” on “/etc/tedge/operations/c8y/”
To debug i subscribed on the thinege device to ‘#’.
But i get nothing when creating my operation for it.

When eg. i try to pull a config via Cumulocity UI, i see the operation on the thinedge broker:
[c8y/s/ds] 526,RPI-Device,tedge-configuration-plugin . Like this i expect to see something when using my custom operation.

Is this an issue with thinedge or with smart rest?
How should custom operations be done with thinedge?

Hi,
I don’t know what you put in your “c8y_Startstream” file, but ensure it looks like this:

[exec]
  topic = "c8y/s/dc/greenhousewebcam"
  on_message = "541"
  command = <path to the script to execute>
  timeout = 10

See documentation: Supported Operations | Thin-edge

Also you need to register your custom template in thin-edge:

sudo tedge config set c8y.smartrest.templates greenhousewebcam

See documentation: SmartRest Template | Thin-edge

Best regards,

Cyril

1 Like

Hi Cyril,

this was fast! I missed the part of registering the template in thin-edge.

Thank you!