How to create EPL template from my frontend code/ Rest API in cumulocity widget

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

Cumulocity IOT 10.11

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

Customer

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

We have created a custom widget where we want to control all of our devices alarms. like get all the alarms, exclate, or event create a alarm on trigger.

We are able to get all the alarms in our widget, but struggling with creating of alarms on threshold trigger.

We know we can create the alarms using smart rule and analytics builder.

But in our case we don’t want to use the out of box application and instead we want to use these apps api and integrate in our custom build widget UI.

So, Can we ask user to give us the device id and threshold value in our widget and UI will call the API which create the EPL workflow in analytics builder?

Thanks

Do you get any error messages? Please provide a full error message screenshot and log file.

No

Have you installed all the latest fixes for the products and systems you are using?

yes

if you are trying to re-build an existing Smart Rule (on threshold alarm) you can just check what api is called under Network tab inside you browser when creating a rule like this in standard UI and simply re-use it

POST {{tenant_url}}/service/smartrule/managedObjects/{{MO_ID}}/smartrules

{
  "type": "c8y_PrivateSmartRule",
  "name": "Create alarm when measurement reaches explicit thresholds",
  "enabled": true,
  "config": {
    "fragment": "Fragment",
    "series": "Series",
    "redRangeMin": 90,
    "redRangeMax": 100,
    "explicitVariant": true,
    "alarmType": "c8y_ThresholdAlarm",
    "alarmText": "Threshold exceeded"
  },
  "c8y_Context": {
    "context": "group",
    "id": "23147706"
  },
  "ruleTemplateName": "explicitThresholdSmartRule",
  "enabledSources": [
    "23147706"
  ]
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.