{
  "api": "alarms-js-api",
  "docsBaseUrl": "https://documentation.opengate.es/",
  "functions": [
    {
      "examples": [
        {
          "code": "openAlarm('subscription_battery_id', 'apnMismatch' , 'apnMismatchRule', 'URGENT', 'MEDIUM', 'APN mismatch with provisioned value')",
          "language": "javascript"
        },
        {
          "code": "openAlarm(undefined, 'highTemperature' , 'highTemperatureRule', 'URGENT', 'MEDIUM', 'Device temperature is high')",
          "language": "javascript"
        }
      ],
      "id": "openAlarm",
      "internal": false,
      "kind": "function",
      "name": "openAlarm",
      "namespace": "",
      "page": {
        "title": "Executing Actions",
        "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/",
        "weight": 20
      },
      "params": [
        {
          "description": "You can open an alarm on device, subscription or subscriber identifier. With _subEntityIdentifier_ you define selected identifier. If is undefined it will open on _provision.administration.identifier_ identifier.",
          "name": "subEntityIdentifier",
          "type": "String"
        },
        {
          "description": "Name that you want to see in opened alarm",
          "name": "alarmName",
          "type": "String"
        },
        {
          "description": "Name of rule that produce opening of alarm.",
          "name": "ruleName",
          "type": "String"
        },
        {
          "description": "Alarm severity. Values can be INFORMATIVE, URGENT or CRITICAL.",
          "name": "severity",
          "type": "String"
        },
        {
          "description": "Alarm priority. Values can be LOW, MEDIUM or HIGH.",
          "name": "priority",
          "type": "String"
        },
        {
          "description": "Alarm description.",
          "name": "alarmDescription",
          "type": "String"
        },
        {
          "description": "Extra information.",
          "name": "extraInfo",
          "type": "String"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "openAlarm(subEntityIdentifier, alarmName, ruleName, severity, priority, alarmDescription, extraInfo)",
      "summary": "\u003e **Deprecated:** Use alarm object functions instead.",
      "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/#openalarmsubentityidentifier-alarmname-rulename-severity-priority-alarmdescription-extrainfo"
    },
    {
      "examples": [
        {
          "code": "closeAlarmByRuleName(undefined, 'highTemperatureRule')",
          "language": "javascript"
        }
      ],
      "id": "closeAlarmByRuleName",
      "internal": false,
      "kind": "function",
      "name": "closeAlarmByRuleName",
      "namespace": "",
      "page": {
        "title": "Executing Actions",
        "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/",
        "weight": 20
      },
      "params": [
        {
          "description": "You can close an alarm on device, subscription or subscriber identifier. With _entityIdDatastream_ you define selected identifier. If is undefined it will close on _provision.administration.identifier_ identifier.",
          "name": "entityIdDatastream",
          "type": "String"
        },
        {
          "description": "Name of rule that open alarm.",
          "name": "ruleName",
          "type": "String"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "closeAlarmByRuleName(entityIdDatastream, ruleName)",
      "summary": "\u003e **Deprecated:** Use alarm object functions instead.",
      "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/#closealarmbyrulenameentityiddatastream-rulename"
    },
    {
      "examples": [
        {
          "code": "closeAlarmByAlarmName(undefined, 'alarm name')",
          "language": "javascript"
        }
      ],
      "id": "closeAlarmByAlarmName",
      "internal": false,
      "kind": "function",
      "name": "closeAlarmByAlarmName",
      "namespace": "",
      "page": {
        "title": "Executing Actions",
        "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/",
        "weight": 20
      },
      "params": [
        {
          "description": "You can close an alarm on device, subscription or subscriber identifier. With _entityIdDatastream_ you define selected identifier. If is undefined it will close on _provision.administration.identifier_ identifier.",
          "name": "entityIdDatastream",
          "type": "String"
        },
        {
          "description": "Name of alarm to close.",
          "name": "alarmName",
          "type": "String"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "closeAlarmByAlarmName(entityIdDatastream, alarmName)",
      "summary": "\u003e **Deprecated:** Use alarm object functions instead.",
      "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/#closealarmbyalarmnameentityiddatastream-alarmname"
    },
    {
      "examples": [
        {
          "code": "parameters = {};\nparameters['deviceIdentifier'] = getDatastreamFromEntity('device.identifier')._current.value;\nparameters['deviceTemperature'] = getDatastreamFromEntity('device.temperature')._current.value;\naddEmailNotification(['example@recipient.es'], 'highTemperature', 'Received high temperature from {{deviceIdentifier}} with value {{deviceTemperature}}', 'highTemperatureRule', parameters);",
          "language": "javascript"
        }
      ],
      "id": "addEmailNotification",
      "internal": false,
      "kind": "function",
      "name": "addEmailNotification",
      "namespace": "",
      "page": {
        "title": "Executing Actions",
        "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/",
        "weight": 20
      },
      "params": [
        {
          "description": "Array of recipients to send email. This param has same format as defined in easy mode.",
          "name": "recipients",
          "type": "Array"
        },
        {
          "description": "Name of notification that will be received in subject field.",
          "name": "notificationName",
          "type": "String"
        },
        {
          "description": "Mustache template with email's body",
          "name": "notificationBody",
          "type": "String"
        },
        {
          "description": "Name of rule that launch email request.",
          "name": "ruleName",
          "type": "String"
        },
        {
          "description": "Json object with key-value pairs that will be replaces in mustache evaluation.",
          "name": "mailParameters",
          "type": "Object"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "addEmailNotification(recipients, notificationName, notificationBody, ruleName, mailParameters)",
      "summary": "\u003e **Deprecated:** Use notification object functions instead.",
      "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/#addemailnotificationrecipients-notificationname-notificationbody-rulename-mailparameters"
    },
    {
      "examples": [
        {
          "code": "var recipients = ['25.35.98.5:8585'];\nvar trapVariables = {\n  '1.1.1': entity['provision.administration.organization']._value._current.value,\n  '1.1.2': entity['provision.administration.channel']._value._current.value,\n  '1.1.3': entity['provision.administration.identifier']._value._current.value,\n  '1.1.4': entity['device.temperature']._value._current.value,\n  '1.1.5': entity['device.temperature']._value._previous.value,\n  '1.1.6': Date.now()\n};         \n\naddTrapNotification(recipients, trapVariables, 'highTemperature', '1.100.1', '1.2.7.3.1.2.25841', 'highTemperatureRule');",
          "language": "javascript"
        }
      ],
      "id": "addTrapNotification",
      "internal": false,
      "kind": "function",
      "name": "addTrapNotification",
      "namespace": "",
      "page": {
        "title": "Executing Actions",
        "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/",
        "weight": 20
      },
      "params": [
        {
          "description": "Array of recipients (`\u003cip\u003e:\u003cport\u003e`) to send trap. This param has same format as defined in easy mode.",
          "name": "recipients",
          "type": "Array"
        },
        {
          "description": "Map of variables. Each pair defines OID variable and sent value for this OID.",
          "name": "variables",
          "type": "Object"
        },
        {
          "description": "Name of notification",
          "name": "notificationName",
          "type": "String"
        },
        {
          "description": "OID of trap",
          "name": "trapOID",
          "type": "String"
        },
        {
          "description": "OID of enterprise",
          "name": "enterpriseOID",
          "type": "String"
        },
        {
          "description": "Name of rule",
          "name": "ruleName",
          "type": "String"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "addTrapNotification(recipients, variables, notificationName, trapOID, enterpriseOID, ruleName)",
      "summary": "\u003e **Deprecated:** Use notification object functions instead.",
      "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/#addtrapnotificationrecipients-variables-notificationname-trapoid-enterpriseoid-rulename"
    },
    {
      "examples": [
        {
          "code": "httpJson = {\n  'url': 'http://myService/request',\n  'method' : 'POST',\n  'headers': {\n    'Content-type': 'application/json'\n  },\n  'queryParams' : {\n    'deviceId' : entity['provision.device.identifier']._value._current.value\n  },\n  'body' : 'New alert received by high temperature received. Current value: ' + entity['device.temperature']._value._current.value\n};\nsendHttp(httpJson);",
          "language": "javascript"
        }
      ],
      "id": "sendHttp",
      "internal": false,
      "kind": "function",
      "name": "sendHttp",
      "namespace": "",
      "page": {
        "title": "Executing Actions",
        "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/",
        "weight": 20
      },
      "params": [
        {
          "description": "Same json that easy mode.",
          "name": "httpJson",
          "type": "Object"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "sendHttp(httpJson)",
      "summary": "\u003e **Deprecated:** Use notification object functions instead.",
      "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/#sendhttphttpjson"
    },
    {
      "examples": [
        {
          "code": "apiKey = getVariableValue(parameters['apiKey']);\nparameters = {\n  'active': false\n};\nexecuteOperation(entity['provision.administration.identifier']._value._current.value, 'REFRESH_PRESENCE', 20000, apiKey, 0, null, null, 25000, 'delayed', parameters, callback);",
          "language": "javascript"
        }
      ],
      "id": "executeOperation",
      "internal": false,
      "kind": "function",
      "name": "executeOperation",
      "namespace": "",
      "page": {
        "title": "Executing Actions",
        "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/",
        "weight": 20
      },
      "params": [
        {
          "description": "You can execute operation on device, subscription or subscriber identifier. With _subEntityIdentifier_ you define selected identifier. If is undefined it will open on _provision.administration.identifier_ identifier.",
          "name": "subEntityIdentifier",
          "type": "String"
        },
        {
          "description": "Operation Identifier. You can get this values getting operation catalog. **Mandatory field**. The rule will be created, but the operation will not.",
          "name": "operationType",
          "type": "String"
        },
        {
          "description": "Operation timeout in milliseconds. **Default**: 60000 milliseconds",
          "name": "operationTimeout",
          "type": "Number"
        },
        {
          "description": "User apiKey that launch this operation. **Mandatory field**. The rule will be created, but the operation will not.",
          "name": "jobUser",
          "type": "String"
        },
        {
          "description": "Operation retries number. **Default**: 0.",
          "name": "retries",
          "type": "Number"
        },
        {
          "description": "ACK timeout in milliseconds. **Default**: null.",
          "name": "ackTimeout",
          "type": "Number"
        },
        {
          "description": "Delay in seconds between retries. **Default**: null.",
          "name": "retriesDelay",
          "type": "Number"
        },
        {
          "description": "Stop value, this value depends of stop mode selected. **Default**: Operation timeout + 5000.",
          "name": "stopValue",
          "type": "Number"
        },
        {
          "description": "Stop mode. **Default**: delayed. Possible values: **date** (stop value is a date in YYYY-MM-DDThh:mm:ssTZD format) and **delayed** (stop value is a time defined in milliseconds).",
          "name": "stopMode",
          "type": "String"
        },
        {
          "description": "URI where the result of the operation execution is received.",
          "name": "callback",
          "type": "String"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "executeOperation(subEntityIdentifier, operationType, operationTimeout, jobUser, retries, ackTimeout, retriesDelay, stopValue, stopMode, parameters, callback)",
      "summary": "\u003e **Deprecated:** Use operation object functions instead.",
      "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/#executeoperationsubentityidentifier-operationtype-operationtimeout-jobuser-retries-acktimeout-retriesdelay-stopvalue-stopmode-parameters-callback"
    },
    {
      "examples": [
        {
          "code": "cancelDelay('highTemperatureRule');",
          "language": "javascript"
        }
      ],
      "id": "cancelDelay",
      "internal": false,
      "kind": "function",
      "name": "cancelDelay",
      "namespace": "",
      "page": {
        "title": "Executing Actions",
        "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/",
        "weight": 20
      },
      "params": [
        {
          "description": "Name of rule that produce delayed actions.",
          "name": "ruleName",
          "type": "String"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "cancelDelay(ruleName)",
      "summary": "\u003e **Deprecated:** Use utils object functions instead.",
      "url": "api/management/organizations/channels/rules/rules_advanced_actions_api/#canceldelayrulename"
    },
    {
      "examples": [
        {
          "code": "alarmConfig = {\n    subEntityIdentifier: \"id\",\n    alarmName: \"apnMismatch\",\n    ruleName: \"apnMismatchRule\",\n    severity: \"URGENT\",\n    priority: \"MEDIUM\",\n    description: \"APN mismatch with provisioned value\",\n    extraInfo: \"Extra information\"\n}\n  \nalarm.open(alarmConfig);",
          "language": "javascript"
        },
        {
          "code": "alarmConfigDevice = {\n    alarmName: \"highTemperature\",\n    ruleName: \"highTemperatureRule\",\n    severity: \"URGENT\",\n    priority: \"MEDIUM\",\n    description: \"Device temperature is high\"\n}\n\nalarm.open(alarmConfigDevice);",
          "language": "javascript"
        }
      ],
      "id": "alarm.open",
      "internal": false,
      "kind": "function",
      "name": "open",
      "namespace": "alarm",
      "page": {
        "title": "Alarm utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_alarms_api/",
        "weight": 30
      },
      "returns": {
        "description": "void"
      },
      "signature": "alarm.open(alarmConfig)",
      "summary": "Opens an alarm.",
      "url": "api/management/organizations/channels/rules/rules_advanced_alarms_api/#alarmopenalarmconfig"
    },
    {
      "examples": [
        {
          "code": "closeByRuleConfig = {\n    ruleName: \"highTemperatureRule\"\n}\n\nalarm.closeByRuleName(closeByRuleConfig);",
          "language": "javascript"
        }
      ],
      "id": "alarm.closeByRuleName",
      "internal": false,
      "kind": "function",
      "name": "closeByRuleName",
      "namespace": "alarm",
      "page": {
        "title": "Alarm utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_alarms_api/",
        "weight": 30
      },
      "returns": {
        "description": "void"
      },
      "signature": "alarm.closeByRuleName(closeByRuleConfig)",
      "summary": "Closes alarm by rule name.",
      "url": "api/management/organizations/channels/rules/rules_advanced_alarms_api/#alarmclosebyrulenameclosebyruleconfig"
    },
    {
      "examples": [
        {
          "code": "closeByNameConfig = {\n    alarmName: \"highTemperatureRule\"\n}\n\nalarm.closeByAlarmName(closeByNameConfig);",
          "language": "javascript"
        }
      ],
      "id": "alarm.closeByAlarmName",
      "internal": false,
      "kind": "function",
      "name": "closeByAlarmName",
      "namespace": "alarm",
      "page": {
        "title": "Alarm utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_alarms_api/",
        "weight": 30
      },
      "returns": {
        "description": "void"
      },
      "signature": "alarm.closeByAlarmName(closeByNameConfig)",
      "summary": "Closes alarm by alarm name.",
      "url": "api/management/organizations/channels/rules/rules_advanced_alarms_api/#alarmclosebyalarmnameclosebynameconfig"
    },
    {
      "examples": [
        {
          "code": "emailNotifConfig = {\n    jsRecipients: ['example@recipient.es'],\n    notificationName: 'highTemperature',\n    notificationBody: 'Received high temperature from {{deviceIdentifier}} with value {{deviceTemperature}}',\n    ruleName: 'highTemperatureRule',\n    mailParameters: {\n        deviceIdentifier: getDatastreamFromEntity('device.identifier')._current.value,\n        deviceTemperature: getDatastreamFromEntity('device.temperature')._current.value\n    }\n}\n    \nnotification.addEmailNotification(emailNotifConfig);",
          "language": "javascript"
        }
      ],
      "id": "notification.addEmailNotification",
      "internal": false,
      "kind": "function",
      "name": "addEmailNotification",
      "namespace": "notification",
      "page": {
        "title": "Notifications utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_notifications_api/",
        "weight": 40
      },
      "returns": {
        "description": "void"
      },
      "signature": "notification.addEmailNotification(emailConfig)",
      "summary": "Sends an email notification to defined recipients.",
      "url": "api/management/organizations/channels/rules/rules_advanced_notifications_api/#notificationaddemailnotificationemailconfig"
    },
    {
      "examples": [
        {
          "code": "trapNotifConfig = {\n    jsRecipients: ['25.35.98.5:8585'],\n    jsVariables: {\n      '1.1.1': entity['provision.administration.organization']._value._current.value,\n      '1.1.2': entity['provision.administration.channel']._value._current.value,\n      '1.1.3': entity['provision.administration.identifier']._value._current.value,\n      '1.1.4': entity['device.temperature']._value._current.value,\n      '1.1.5': entity['device.temperature']._value._previous.value,\n      '1.1.6': Date.now()\n    },\n    notificationName: 'highTemperature',\n    trapOID: '1.100.1',\n    enterpriseOID: '1.2.7.3.1.2.25841',\n    ruleName: 'highTemperatureRule'\n}\n\nnotification.addTrapNotification(trapNotifConfig);",
          "language": "javascript"
        }
      ],
      "id": "notification.addTrapNotification",
      "internal": false,
      "kind": "function",
      "name": "addTrapNotification",
      "namespace": "notification",
      "page": {
        "title": "Notifications utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_notifications_api/",
        "weight": 40
      },
      "signature": "notification.addTrapNotification(trapConfig)",
      "summary": "Sends an SNMP trap notification to defined recipients.",
      "url": "api/management/organizations/channels/rules/rules_advanced_notifications_api/#notificationaddtrapnotificationtrapconfig"
    },
    {
      "examples": [
        {
          "code": "httpJson = {\n  'url': 'http://myService/request',\n  'method' : 'POST',\n  'headers': {\n    'Content-type': 'application/json'\n  },\n  'queryParams' : {\n    'deviceId' : entity['provision.device.identifier']._value._current.value\n  },\n  'body' : 'New alert received by high temperature received. Current value: ' + entity['device.temperature']._value._current.value\n};\n\nnotification.sendHttp(httpJson);",
          "language": "javascript"
        }
      ],
      "id": "notification.sendHttp",
      "internal": false,
      "kind": "function",
      "name": "sendHttp",
      "namespace": "notification",
      "page": {
        "title": "Notifications utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_notifications_api/",
        "weight": 40
      },
      "returns": {
        "description": "void"
      },
      "signature": "notification.sendHttp(httpConfig)",
      "summary": "Sends an HTTP request notification to a specified URL.",
      "url": "api/management/organizations/channels/rules/rules_advanced_notifications_api/#notificationsendhttphttpconfig"
    },
    {
      "examples": [
        {
          "code": "operationConfig = {\n    subEntityIdentifier: entity['provision.administration.identifier']._value._current.value,\n    operationType: 'ADMINISTRATIVE_STATUS_CHANGE',     \n    operationTimeout: 20000,   \n    jobUser: apiKey,           \n    retries: 1,            \n    ackTimeout: 5000,        \n    retriesDelay: 0,      \n    stopValue: '25000',         \n    stopMode: 'delayed',\n    callback: 'http://127.0.0.1:7070/directory',\n    parameters: {\n        admsts: 'BANNED'\n    }\n}\n\noperation.execute(operationConfig);",
          "language": "javascript"
        },
        {
          "code": "operationConfig = {\n    subEntityIdentifier: entity['provision.administration.identifier']._value._current.value,\n    operationType: 'REFRESH_PRESENCE',     \n    operationTimeout: 20000,   \n    jobUser: apiKey,           \n    retries: 1,            \n    ackTimeout: 5000,        \n    retriesDelay: 0,      \n    stopMode: 'date',\n    stopValue: '2045-11-08T08:30:00+02:00',\n    callback: 'http://127.0.0.1:7070/directory',\n    parameters: {}\n}\n\noperation.execute(operationConfig);",
          "language": "javascript"
        }
      ],
      "id": "operation.execute",
      "internal": false,
      "kind": "function",
      "name": "execute",
      "namespace": "operation",
      "page": {
        "title": "Operation utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_operations_api/",
        "weight": 50
      },
      "params": [
        {
          "description": "URI where the result of the operation execution is received.",
          "name": "callback",
          "type": "String"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "operation.execute(operationConfig)",
      "summary": "Execute selected operation to received identifier.",
      "url": "api/management/organizations/channels/rules/rules_advanced_operations_api/#operationexecuteoperationconfig"
    },
    {
      "examples": [
        {
          "code": "var provisionConfig = {\n    datastreams: {'datastream1':'value1','datastreamN':'valueN'},\n    apiKey: 'the_api_key'\n}\n\nprovision.datastreams(provisionConfig);",
          "language": "javascript"
        }
      ],
      "id": "provision.datastreams",
      "internal": false,
      "kind": "function",
      "name": "datastreams",
      "namespace": "provision",
      "page": {
        "title": "Provision utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_provision_api/",
        "weight": 60
      },
      "returns": {
        "description": "void"
      },
      "signature": "provision.datastreams(provisionConfig)",
      "summary": "This function takes as parameter an object with the following fields:",
      "url": "api/management/organizations/channels/rules/rules_advanced_provision_api/#provisiondatastreamsprovisionconfig"
    },
    {
      "examples": [
        {
          "code": "var myVar = undefined;\nvar finalVar = getVariableValue(myVar);",
          "language": "javascript"
        },
        {
          "code": "var myVar = 2;\nvar finalVar = getVariableValue(myVar);",
          "language": "javascript"
        }
      ],
      "id": "getVariableValue",
      "internal": false,
      "kind": "function",
      "name": "getVariableValue",
      "namespace": "",
      "page": {
        "title": "Datastreams and values",
        "url": "api/management/organizations/channels/rules/rules_advanced_datastreams_api/",
        "weight": 70
      },
      "params": [
        {
          "description": "Variable to obtain value.",
          "name": "variable",
          "type": "String"
        }
      ],
      "returns": {
        "description": "The read value, or undefined if the variable is not found."
      },
      "signature": "getVariableValue(variable)",
      "summary": "This method reads a variable value.",
      "url": "api/management/organizations/channels/rules/rules_advanced_datastreams_api/#getvariablevaluevariable"
    },
    {
      "examples": [
        {
          "code": "var deviceTemperature = getDatastreamFromEntity('device.temperature');",
          "language": "javascript"
        },
        {
          "code": "{\n  \"_received\": [\n    {\n      \"value\": 25.3,\n      \"date\": \"2017-12-01T08:52:37.64Z\",\n      \"at\": \"2017-12-01T08:52:37.64Z\",\n      \"source\": \"DEVICE_OPENGATE_HTTP\",\n      \"sourceInfo\": \"IoT Data Message Received\"\n    }\n  ],\n  \"_current\": {\n    \"value\": 25.3,\n    \"date\": \"2017-12-01T08:52:37.64Z\",\n    \"at\": \"2017-12-01T08:52:37.64Z\",\n    \"source\": \"DEVICE_OPENGATE_HTTP\",\n    \"sourceInfo\": \"IoT Data Message Received\"\n  },\n  \"_previous\": {\n    \"value\": 23.3,\n    \"date\": \"2017-12-01T05:52:37.64Z\",\n    \"at\": \"2017-12-01T05:52:37.64Z\",\n    \"source\": \"DEVICE_OPENGATE_HTTP\",\n    \"sourceInfo\": \"IoT Data Message Received\"\n  }\n}",
          "language": "json"
        }
      ],
      "id": "getDatastreamFromEntity",
      "internal": false,
      "kind": "function",
      "name": "getDatastreamFromEntity",
      "namespace": "",
      "page": {
        "title": "Datastreams and values",
        "url": "api/management/organizations/channels/rules/rules_advanced_datastreams_api/",
        "weight": 70
      },
      "params": [
        {
          "description": "Datastream to obtain value.",
          "name": "datastreamId",
          "type": "String"
        }
      ],
      "returns": {
        "description": "Completed datastream or undefined if the datastream is not found."
      },
      "signature": "getDatastreamFromEntity(datastreamId)",
      "summary": "This method returns completed datastream of received entity.",
      "url": "api/management/organizations/channels/rules/rules_advanced_datastreams_api/#getdatastreamfromentitydatastreamid"
    },
    {
      "examples": [
        {
          "code": "var deviceTemperature = getDatastreamFromEntity('device.temperature');\nvar deviceTemperatureValue = getDatastreamValueFromEntity(deviceTemperature);",
          "language": "javascript"
        },
        {
          "code": "{\n  \"value\": 25.3,\n  \"date\": \"2017-12-01T08:52:37.64Z\",\n  \"at\": \"2017-12-01T08:52:37.64Z\",\n  \"source\": \"DEVICE_OPENGATE_HTTP\",\n  \"sourceInfo\": \"IoT Data Message Received\"\n}",
          "language": "json"
        }
      ],
      "id": "getDatastreamValueFromEntity",
      "internal": false,
      "kind": "function",
      "name": "getDatastreamValueFromEntity",
      "namespace": "",
      "page": {
        "title": "Datastreams and values",
        "url": "api/management/organizations/channels/rules/rules_advanced_datastreams_api/",
        "weight": 70
      },
      "params": [
        {
          "description": "Datastream object.",
          "name": "datastreamObject",
          "type": "Object"
        }
      ],
      "returns": {
        "description": "Value object from datastream object."
      },
      "signature": "getDatastreamValueFromEntity(datastreamObject)",
      "summary": "Returns _value._current._value from datastream object",
      "url": "api/management/organizations/channels/rules/rules_advanced_datastreams_api/#getdatastreamvaluefromentitydatastreamobject"
    },
    {
      "examples": [
        {
          "code": "datastream = getCommsDatastreamFromEntity('device.communicationModules[].subscription.address', 'commsMod_battery_id');",
          "language": "javascript"
        },
        {
          "code": "{\n  \"_current\": {\n    \"value\": {\n      \"type\": \"IPV4\",\n      \"value\": \"99.1.1.71\",\n      \"apn\": \"myapn.es\"\n    },\n    \"date\": \"2017-12-01T08:52:37.624Z\",\n    \"at\": \"2017-12-01T08:52:37.624Z\",\n    \"source\": \"DEVICE_OPENGATE_HTTP\",\n    \"sourceInfo\": \"IoT Data Message Received\"\n  },\n  \"_previous\": {\n    \"value\": {\n      \"type\": \"IPV4\",\n      \"value\": \"99.1.1.71\",\n      \"apn\": \"myapn.es\"\n    },\n    \"date\": \"2017-12-01T08:52:37.624Z\",\n    \"at\": \"2017-12-01T08:52:37.624Z\",\n    \"source\": \"DEVICE_OPENGATE_HTTP\",\n    \"sourceInfo\": \"IoT Data Message Received\"\n  }\n}",
          "language": "json"
        }
      ],
      "id": "getCommsDatastreamFromEntity",
      "internal": false,
      "kind": "function",
      "name": "getCommsDatastreamFromEntity",
      "namespace": "",
      "page": {
        "title": "Datastreams and values",
        "url": "api/management/organizations/channels/rules/rules_advanced_datastreams_api/",
        "weight": 70
      },
      "params": [
        {
          "description": "Datastream to obtain value.",
          "name": "datastreamId",
          "type": "String"
        },
        {
          "description": "Communication module identifier.",
          "name": "commsId",
          "type": "String"
        }
      ],
      "returns": {
        "description": "Complete datastream or undefined if the datastream is not found."
      },
      "signature": "getCommsDatastreamFromEntity(datastreamId, commsId)",
      "summary": "Returns complete datastream in selected communication module of received entity.",
      "url": "api/management/organizations/channels/rules/rules_advanced_datastreams_api/#getcommsdatastreamfromentitydatastreamid-commsid"
    },
    {
      "examples": [
        {
          "code": "var datastream = {'value':3, 'date': toDate('2021-06-30T11:20:21.352Z')}\nvar resetDate = toDate('2021-06-30T00:00:0.000Z');\nvar counter = getCounterValue(datastream, 1, resetDate); ",
          "language": "javascript"
        },
        {
          "code": "var datastream = {'value':3, 'date': toDate('2021-06-29T11:20:21.352Z')}\nvar resetDate = toDate('2021-06-30T00:00:0.000Z');\nvar counter = getCounterValue(datastream, 1, resetDate); ",
          "language": "javascript"
        }
      ],
      "id": "getCounterValue",
      "internal": false,
      "kind": "function",
      "name": "getCounterValue",
      "namespace": "",
      "page": {
        "title": "Datastreams and values",
        "url": "api/management/organizations/channels/rules/rules_advanced_datastreams_api/",
        "weight": 70
      },
      "params": [
        {
          "description": "Datastream value.",
          "name": "datastreamValue",
          "type": "Object"
        },
        {
          "description": "Value to increment.",
          "name": "incValue",
          "type": "Number"
        },
        {
          "description": "Date of reset.",
          "name": "resetDate",
          "type": "Date"
        }
      ],
      "returns": {
        "description": "Incremented value or reset value."
      },
      "signature": "getCounterValue(datastreamValue, incValue, resetDate)",
      "summary": "Obtains incValue if datastreamValue date is before than resetDate or increments received value in datastream to incValue if the date is after.",
      "url": "api/management/organizations/channels/rules/rules_advanced_datastreams_api/#getcountervaluedatastreamvalue-incvalue-resetdate"
    },
    {
      "examples": [
        {
          "code": "var date = toDate('2021-06-30T10:10:23.256Z');",
          "language": "javascript"
        }
      ],
      "id": "toDate",
      "internal": false,
      "kind": "function",
      "name": "toDate",
      "namespace": "",
      "page": {
        "title": "Dates manipulation",
        "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/",
        "weight": 80
      },
      "params": [
        {
          "description": "Date string representation with format YYYY-MM-DDThh:mm:ssTZD.",
          "name": "localDateTime",
          "type": "string"
        }
      ],
      "returns": {
        "description": "Date"
      },
      "signature": "toDate(localDateTime)",
      "summary": "Obtain date type from string date representation with format YYYY-MM-DDThh:mm:ssTZD.",
      "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/#todatelocaldatetime"
    },
    {
      "examples": [
        {
          "code": "var date = getDailyResetDate();",
          "language": "javascript"
        }
      ],
      "id": "getDailyResetDate",
      "internal": false,
      "kind": "function",
      "name": "getDailyResetDate",
      "namespace": "",
      "page": {
        "title": "Dates manipulation",
        "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/",
        "weight": 80
      },
      "returns": {
        "description": "Date"
      },
      "signature": "getDailyResetDate()",
      "summary": "Obtains date to reset daily counters.",
      "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/#getdailyresetdate"
    },
    {
      "examples": [
        {
          "code": "var date = getDailyResetDateWithZuluHour('02:00:00');",
          "language": "javascript"
        }
      ],
      "id": "getDailyResetDateWithZuluHour",
      "internal": false,
      "kind": "function",
      "name": "getDailyResetDateWithZuluHour",
      "namespace": "",
      "page": {
        "title": "Dates manipulation",
        "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/",
        "weight": 80
      },
      "params": [
        {
          "description": "Hour in format HH:mm:ss.",
          "name": "hour",
          "type": "string"
        }
      ],
      "returns": {
        "description": "Date"
      },
      "signature": "getDailyResetDateWithZuluHour(hour)",
      "summary": "Obtains date to reset daily counters with defined hour in gmt+0.",
      "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/#getdailyresetdatewithzuluhourhour"
    },
    {
      "examples": [
        {
          "code": "var date = getMonthlyResetDate();",
          "language": "javascript"
        }
      ],
      "id": "getMonthlyResetDate",
      "internal": false,
      "kind": "function",
      "name": "getMonthlyResetDate",
      "namespace": "",
      "page": {
        "title": "Dates manipulation",
        "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/",
        "weight": 80
      },
      "returns": {
        "description": "Date"
      },
      "signature": "getMonthlyResetDate()",
      "summary": "Obtains date to reset monthly counters.",
      "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/#getmonthlyresetdate"
    },
    {
      "examples": [
        {
          "code": "var date = getMonthlyResetDateWithZuluHour('02:00:00');",
          "language": "javascript"
        }
      ],
      "id": "getMonthlyResetDateWithZuluHour",
      "internal": false,
      "kind": "function",
      "name": "getMonthlyResetDateWithZuluHour",
      "namespace": "",
      "page": {
        "title": "Dates manipulation",
        "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/",
        "weight": 80
      },
      "params": [
        {
          "description": "Hour in format HH:mm:ss.",
          "name": "hour",
          "type": "string"
        }
      ],
      "returns": {
        "description": "Date"
      },
      "signature": "getMonthlyResetDateWithZuluHour(hour)",
      "summary": "Obtains date to reset monthly counters with defined hour in gmt+0.",
      "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/#getmonthlyresetdatewithzuluhourhour"
    },
    {
      "examples": [
        {
          "code": "var date = getMonthlyResetDateWithZuluHourAndDayOfMonth('02:00:00', 21);",
          "language": "javascript"
        }
      ],
      "id": "getMonthlyResetDateWithZuluHourAndDayOfMonth",
      "internal": false,
      "kind": "function",
      "name": "getMonthlyResetDateWithZuluHourAndDayOfMonth",
      "namespace": "",
      "page": {
        "title": "Dates manipulation",
        "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/",
        "weight": 80
      },
      "params": [
        {
          "description": "Hour in format HH:mm:ss.",
          "name": "hour",
          "type": "string"
        },
        {
          "description": "Day of Month.",
          "name": "dayOfMonth",
          "type": "number"
        }
      ],
      "returns": {
        "description": "Date"
      },
      "signature": "getMonthlyResetDateWithZuluHourAndDayOfMonth(hour, dayOfMonth)",
      "summary": "Obtains date to reset monthly counters with defined hour in gmt+0.",
      "url": "api/management/organizations/channels/rules/rules_advanced_dates_api/#getmonthlyresetdatewithzuluhouranddayofmonthhour-dayofmonth"
    },
    {
      "examples": [
        {
          "code": "logger.trace('Operation sent to', host_var, ' and port ', port_var, '. Operation content: ', operation_var);",
          "language": "javascript"
        }
      ],
      "id": "logger.trace",
      "internal": false,
      "kind": "function",
      "name": "trace",
      "namespace": "logger",
      "page": {
        "title": "Logging utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_logging_api/",
        "weight": 90
      },
      "params": [
        {
          "description": "list of elements to be concatenated to generate the string message to be printed.",
          "name": "msg",
          "type": "string"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "logger.trace(...msg)",
      "summary": "Creates TRACE level logging messages. It concatenates msg parameters to compound message to be logged.",
      "url": "api/management/organizations/channels/rules/rules_advanced_logging_api/#loggertracemsg"
    },
    {
      "examples": [
        {
          "code": "logger.debug('Operation sent to', host_var, ' and port ', port_var, '. Operation content: ', operation_var);",
          "language": "javascript"
        }
      ],
      "id": "logger.debug",
      "internal": false,
      "kind": "function",
      "name": "debug",
      "namespace": "logger",
      "page": {
        "title": "Logging utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_logging_api/",
        "weight": 90
      },
      "params": [
        {
          "description": "list of elements to be concatenated to generate the string message to be printed.",
          "name": "msg",
          "type": "string"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "logger.debug(...msg)",
      "summary": "Creates DEBUG level logging messages. It concatenates msg parameters to compound message to be logged.",
      "url": "api/management/organizations/channels/rules/rules_advanced_logging_api/#loggerdebugmsg"
    },
    {
      "examples": [
        {
          "code": "logger.info('Operation sent to', host_var, ' and port ', port_var, '. Operation content: ', operation_var);",
          "language": "javascript"
        }
      ],
      "id": "logger.info",
      "internal": false,
      "kind": "function",
      "name": "info",
      "namespace": "logger",
      "page": {
        "title": "Logging utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_logging_api/",
        "weight": 90
      },
      "params": [
        {
          "description": "list of elements to be concatenated to generate the string message to be printed.",
          "name": "msg",
          "type": "string"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "logger.info(...msg)",
      "summary": "Creates INFO level logging messages. It concatenates msg parameters to compound message to be logged.",
      "url": "api/management/organizations/channels/rules/rules_advanced_logging_api/#loggerinfomsg"
    },
    {
      "examples": [
        {
          "code": "logger.warn('Operation sent to', host_var, ' and port ', port_var, '. Operation content: ', operation_var);",
          "language": "javascript"
        }
      ],
      "id": "logger.warn",
      "internal": false,
      "kind": "function",
      "name": "warn",
      "namespace": "logger",
      "page": {
        "title": "Logging utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_logging_api/",
        "weight": 90
      },
      "params": [
        {
          "description": "list of elements to be concatenated to generate the string message to be printed.",
          "name": "msg",
          "type": "string"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "logger.warn(...msg)",
      "summary": "Creates WARN level logging messages. It concatenates msg parameters to compound message to be logged.",
      "url": "api/management/organizations/channels/rules/rules_advanced_logging_api/#loggerwarnmsg"
    },
    {
      "examples": [
        {
          "code": "logger.error('Error connecting to host ', host_var, ' and port ', port_var, '. Stop processing');",
          "language": "javascript"
        }
      ],
      "id": "logger.error",
      "internal": false,
      "kind": "function",
      "name": "error",
      "namespace": "logger",
      "page": {
        "title": "Logging utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_logging_api/",
        "weight": 90
      },
      "params": [
        {
          "description": "list of elements to be concatenated to generate the string message to be printed.",
          "name": "msg",
          "type": "string"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "logger.error(...msg)",
      "summary": "Creates ERROR level logging messages. It concatenates msg parameters to compound message to be logged.",
      "url": "api/management/organizations/channels/rules/rules_advanced_logging_api/#loggererrormsg"
    },
    {
      "examples": [
        {
          "code": "var encryptedValue = encryptString('text to encrypt', 'provision.data.encrypt', 'organization_name');",
          "language": "javascript"
        }
      ],
      "id": "encryptString",
      "internal": false,
      "kind": "function",
      "name": "encryptString",
      "namespace": "",
      "page": {
        "title": "Cypher utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_cypher_api/",
        "weight": 100
      },
      "params": [
        {
          "description": "The original value to encrypt.",
          "name": "originalValue",
          "type": "string"
        },
        {
          "description": "The datastream of provision type, of the datamodel that define this value.",
          "name": "datastreamId",
          "type": "string"
        },
        {
          "description": "The organization name to which the datamodel belongs.",
          "name": "organization",
          "type": "string"
        }
      ],
      "returns": {
        "description": "String"
      },
      "signature": "encryptString(originalValue, datastreamId, organization)",
      "summary": "\u003e **Deprecated:** Use utils object functions instead.",
      "url": "api/management/organizations/channels/rules/rules_advanced_cypher_api/#encryptstringoriginalvalue-datastreamid-organization"
    },
    {
      "examples": [
        {
          "code": "var decryptedValue = decryptString('text to decrypt', 'provision.data.encrypt', 'organization_name');",
          "language": "javascript"
        }
      ],
      "id": "decryptString",
      "internal": false,
      "kind": "function",
      "name": "decryptString",
      "namespace": "",
      "page": {
        "title": "Cypher utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_cypher_api/",
        "weight": 100
      },
      "params": [
        {
          "description": "The encrypted value to decrypt.",
          "name": "encryptedValue",
          "type": "string"
        },
        {
          "description": "The datastream of provision type, of the datamodel that define this value.",
          "name": "datastreamId",
          "type": "string"
        },
        {
          "description": "The organization name to which the datamodel belongs.",
          "name": "organization",
          "type": "string"
        }
      ],
      "returns": {
        "description": "String"
      },
      "signature": "decryptString(encryptedValue, datastreamId, organization)",
      "summary": "\u003e **Deprecated:** Use utils object functions instead.",
      "url": "api/management/organizations/channels/rules/rules_advanced_cypher_api/#decryptstringencryptedvalue-datastreamid-organization"
    },
    {
      "examples": [
        {
          "code": "utils.cancelDelay('highTemperatureRule');",
          "language": "javascript"
        }
      ],
      "id": "utils.cancelDelay",
      "internal": false,
      "kind": "function",
      "name": "cancelDelay",
      "namespace": "utils",
      "page": {
        "title": "Utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_utils_api/",
        "weight": 110
      },
      "params": [
        {
          "description": "Name of rule that produce delayed actions.",
          "name": "ruleName",
          "type": "String"
        }
      ],
      "returns": {
        "description": "void"
      },
      "signature": "utils.cancelDelay(ruleName)",
      "summary": "Cancels an active delayed action produced by another rule activation.",
      "url": "api/management/organizations/channels/rules/rules_advanced_utils_api/#utilscanceldelayrulename"
    },
    {
      "examples": [
        {
          "code": "encryptConfig = {\n    originalValue: 'text to encrypt',\n    datastreamId: 'provision.data.encrypt',\n    organization: 'organization_name'\n}\n\nvar encryptedValue = utils.encryptString(encryptConfig);",
          "language": "javascript"
        }
      ],
      "id": "utils.encryptString",
      "internal": false,
      "kind": "function",
      "name": "encryptString",
      "namespace": "utils",
      "page": {
        "title": "Utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_utils_api/",
        "weight": 110
      },
      "returns": {
        "description": "String"
      },
      "signature": "utils.encryptString(encryptConfig)",
      "summary": "Encrypt a value.",
      "url": "api/management/organizations/channels/rules/rules_advanced_utils_api/#utilsencryptstringencryptconfig"
    },
    {
      "examples": [
        {
          "code": "decryptConfig = {\n    encryptedValue: 'text to decrypt',\n    datastreamId: 'provision.data.encrypt',\n    organization: 'organization_name'\n}\n\nvar decryptedValue = utils.decryptString(decryptConfig);",
          "language": "javascript"
        }
      ],
      "id": "utils.decryptString",
      "internal": false,
      "kind": "function",
      "name": "decryptString",
      "namespace": "utils",
      "page": {
        "title": "Utils",
        "url": "api/management/organizations/channels/rules/rules_advanced_utils_api/",
        "weight": 110
      },
      "returns": {
        "description": "String"
      },
      "signature": "utils.decryptString(decryptConfig)",
      "summary": "Decrypt a value.",
      "url": "api/management/organizations/channels/rules/rules_advanced_utils_api/#utilsdecryptstringdecryptconfig"
    }
  ],
  "generatedAt": "2026-08-17T11:35:12Z",
  "internal": false,
  "platformVersion": "20.5.1-SNAPSHOT",
  "schemaVersion": "1.0"
}