Hi,
I work on a script which add an alarm in tags.
I use system.tag.getConfiguration() to get json tag and I add an alarm in 'alarms' key.
My config before adding new alarm :
{
"tagGroup": "PHPScriptExecution",
"expression": "runScript(\"shared.alarms.daily(\"+{device_id}+\",\"+{project_id}+\",\"+{dailyHour1}+\",\"+{dailyHour2}+\")\")",
"alarms": [],
"query": "SELECT avg(value) FROM admin.m_data WHERE device_id\u003d{device_id} and project_id\u003d{[~]project_id} and datetime \u003e\u003d DATE_FORMAT(now()-interval 1 day,\u0027%Y-%m-%d 00:00:00\u0027) and datetime \u003c DATE_FORMAT(now()-interval 1 day,\u0027%Y-%m-%d 23:59:59\u0027)",
"dataType": "Float4",
"writePermissions": "{\"type\":\"AllOf\",\"securityLevels\":[]}",
"executionMode": "TagGroupRate",
"readOnly": false,
"enabled": true,
"path": "[test]ACW-TH 1CD279/value_daily",
"readPermissions": "{\"type\":\"AllOf\",\"securityLevels\":[]}",
"datasource": "",
"tagType": "AtomicTag",
"name": "value_daily",
"valueSource": "expr"
}
My config after :
{
"tagGroup": "PHPScriptExecution",
"expression": "runScript(\"shared.alarms.daily(\"+{device_id}+\",\"+{project_id}+\",\"+{dailyHour1}+\",\"+{dailyHour2}+\")\")",
"alarms": [
{
"activePipeline": "alarm-pipelines/home_pipeline",
"setpointA": 18,
"CustomEmailSubject": {
"bindType": "Expression",
"value": "concat(\"[ALARME] \",if(isNull(jsonGet({[~]project_info.value},\u0027outputs\u0027)),\u0027#titleError\u0027,jsonGet({[~]project_info.value},\u0027outputs[0].title\u0027)),\" : \",{name})"
},
"setpointB": 25,
"displayPath": {
"bindType": "Expression",
"value": "concat(\u0027user/\u0027,{database},\u0027/\u0027,toStr(toInt({alarm_id})),\u0027/\u0027,{name})"
},
"priority": "High",
"enabled": true,
"mode": "OutsideValues",
"name": "confort test",
"alarm_id": 162,
"inclusiveA": false,
"CustomEmailMessage": {
"bindType": "Expression",
"value": "concat(\"Valeur : \\\"\",{setpointA},\"\\\" | Type : Est \\xe9gale xe0 \",\" | \",\"Valeur en alerte : moyenne sur \\\"\",{nb_hours},\"\\\" heures : \\\"\",{value})\")"
},
"inclusiveB": false
}
],
"query": "SELECT avg(value) FROM admin.m_data WHERE device_id\u003d{device_id} and project_id\u003d{[~]project_id} and datetime \u003e\u003d DATE_FORMAT(now()-interval 1 day,\u0027%Y-%m-%d 00:00:00\u0027) and datetime \u003c DATE_FORMAT(now()-interval 1 day,\u0027%Y-%m-%d 23:59:59\u0027)",
"dataType": "Float4",
"writePermissions": "{\"type\":\"AllOf\",\"securityLevels\":[]}",
"executionMode": "TagGroupRate",
"readOnly": false,
"enabled": true,
"path": "[test]ACW-TH 1CD279/value_daily",
"readPermissions": "{\"type\":\"AllOf\",\"securityLevels\":[]}",
"datasource": "",
"tagType": "AtomicTag",
"name": "value_daily",
"valueSource": "expr"
}
I have error below :
Blockquote
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
File "function:runAction", line 5, in runAction
File "module:alarm", line 1364, in createAlarm
RuntimeError: maximum recursion depth exceeded (Java StackOverflowError)
at org.python.core.Py.RuntimeError(Py.java:157)
at org.python.core.Py.JavaError(Py.java:540)
at org.python.core.Py.JavaError(Py.java:538)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:192)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.call(ScriptManager.java:546)
at org.python.core.PyObject.call(PyObject.java:494)
at org.python.core.PyObject.call(PyObject.java:498)
at org.python.pycode._pyx9885.createAlarm$20(module:alarm:1388)
at org.python.pycode._pyx9885.call_function(module:alarm)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
at org.python.core.PyFunction.call(PyFunction.java:416)
at org.python.pycode.pyx10296.runAction$1(function:runAction:12)
at org.python.pycode.pyx10296.call_function(function:runAction)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyFunction.function___call(PyFunction.java:474)
at org.python.core.PyFunction.call(PyFunction.java:469)
at org.python.core.PyFunction.call(PyFunction.java:464)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:849)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:831)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:689)
at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:1000)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:754)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:136)
at com.inductiveautomation.perspective.gateway.action.ScriptAction.runAction(ScriptAction.java:71)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.lambda$call$0(ActionCollection.java:263)
at com.inductiveautomation.perspective.gateway.api.LoggingContext.mdc(LoggingContext.java:54)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:252)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:221)
at com.inductiveautomation.perspective.gateway.threading.BlockingTaskQueue$TaskWrapper.run(BlockingTaskQueue.java:154)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.inductiveautomation.perspective.gateway.threading.BlockingWork$BlockingWorkRunnable.run(BlockingWork.java:42)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException
Traceback (most recent call last):
File "function:runAction", line 5, in runAction
File "module:alarm", line 1364, in createAlarm
RuntimeError: maximum recursion depth exceeded (Java StackOverflowError)
Thanks for your help.