Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Bulk Event Detection Creation


  • We're deploying a new system and the data source has about 1,800 fault bits (200 in each subsystem and 9 subsystems).

    There are binary status bits that indicate faults or alarms of a subsystem. Creating the data points has been relatively automated through the CSV uploader, however, we cannot seem to find a method to automate the creation of level based event detection on each of these bits.

    Does anyone have suggestions or thoughts on how we could automate the creation of these event detectors?


  • Without writing your own component it will be difficult IMO.
    Iterate through each point, create it, then use the event detector API to attach the required alarms to that newly created point. Rinse and repeat....

    Seeing how the CSV can be imported into the API you can still make your own CSV uploader then send one line at a time, so the callback gives you the info you need to make your detectors.

    Phil/Jared will likely be able to expand on this or provide a better solution.


  • @chio This is one area which is lacking at the moment, we have been discussing this recently in fact. We will probably be adding the ability to import / export the event detectors via CSV soon.

    In the meantime, the easiest way to bulk edit them would be to use the JSON import/export (Under Administration - Home - Configuration import/export). Use a script or tool to modify the JSON and re-import.


  • This thread was my last go at simplest mass event detector creation, by leveraging watchlists: https://forum.infiniteautomation.com/topic/3708/a-script-jsonemport-example


  • Thanks for these thoughts. We're review the JSON idea and Phili's last script.

    Our other thought was to use the real time values every x seconds through API and check if type = binary and name contains "fault" then do some task... this would be outside of Mango though so its not 100% desired but could be a scaleable work around.


  • @chio You could also use your favorite scripting language to create the event detectors via the REST API.


  • @Jared-Wiltshire do you have a data structure for creating an event detector? We're connected through the API and have been able to Get the existing even-detectors to look for a model as Swagger doesn't have a lot of information for POST /v2/event-detectors

    Here is the response we get from /v2/event-detectors/data-point/{xid}

    [
      {
        "xid": "ED_e7f4ceb7-baca-4842-b22c-897a4e2d87fe",
        "name": "PCS3 Has Faulted",
        "duration": 5,
        "durationType": "MINUTES",
        "alarmLevel": "CRITICAL",
        "supportedDataTypes": [
          "MULTISTATE"
        ],
        "handlers": [
          "EH_43fde3cf-1c12-483b-820c-9392c38f114e"
        ],
        "description": "PCS3 Has Faulted",
        "eventType": {
          "dataSourceId": 2,
          "dataPointId": 995,
          "pointEventDetectorId": 110,
          "duplicateHandling": "IGNORE",
          "rateLimited": false,
          "typeName": "DATA_POINT"
        },
        "sourceId": 995,
        "rtnApplicable": true,
        "detectorSourceType": "DATA_POINT",
        "validationMessages": [],
        "detectorType": "MULTISTATE_STATE",
        "id": 110
      }
    ]
    

    What i dont see from the return of the GET is how we set the XID of the data point and the level. For example the above is set by a data point on value 8. Im not seeing in the return the XID of the datapoint that triggers this event detector or to look for value 8.

    What are we missing?


  • OK, use /rest/v2/full-event-detectors instead, this API is newer and allows you to link handlers to the event detector in one hit (set the handlerXids property to an array of handler XIDs, if it is null it will not update the linked handlers).

    Now onto your main question, you will have to link the event detector to the data point id. You set the sourceId property to the data point's id. I know this is weird, it really shouldn't be like this as everything else uses xids, I will try and get this changed.

    The JSON to POST to the endpoint will look like

    {
        "detectorType" : "MULTISTATE_STATE",
        "sourceId" : 995,
        "rtnApplicable" : true,
        "alarmLevel" : "CRITICAL",
        "sourceTypeName" : "DATA_POINT",
        "handlerXids" : [ ],
        "duration" : {
          "periods" : 5,
          "type" : "MINUTES"
        },
        "state" : 5,
        "detectorType" : "MULTISTATE_STATE",
        "name" : "PCS3 Has Faulted"
    }
    

  • @jared-wiltshire said in Bulk Event Detection Creation:

    when i try to use /rest/v2-full-event-detectors i get the below error

    raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    

    however, event-dectors still works. Can you confirm the 'state' parameter should be set to the value that will trigger the event?


  • @chio That is a Python error, its not something coming from Mango. Without seeing the actual JSON reply from Mango I can't tell you much.

    @chio said in Bulk Event Detection Creation:

    Can you confirm the 'state' parameter should be set to the value that will trigger the event?

    The state property is the integer value of the multistate state to detect.