Setting Several Data Points at once
-
@mattfox
Really! Awesome, do not worry about the time, here is 19:21 (March 5) now.
Paraguayan time.
I could read it later tonight or even tomorrow and try to apply it.Thanks a lot!
-
11:34 AM here NZDT.
Ill have something here for you by breakfast :)
-
You are the best!
-
OK!
First off, apologies Rodrigo. I can see where you got lost. The script was marginally more involved than I first suspected...
However. as promised: here is the solution for you to learn from and apply for your own personal use.I have 3 batches of JSON for you to import and view to appreciate what to do. I have modelled this with virtual data sources for a proof of concept which can be applied in other places.
Virtual Datasource + points:
{ "dataSources":[ { "xid":"DS_233ecafd-78eb-4837-98fc-8cbdb35430bc", "name":"Temp Virtual", "enabled":true, "type":"VIRTUAL", "alarmLevels":{ "POLL_ABORTED":"URGENT" }, "purgeType":"YEARS", "updatePeriods":1, "updatePeriodType":"MINUTES", "polling":false, "quantize":false, "useCron":false, "editPermission":"", "purgeOverride":false, "purgePeriod":1 } ], "dataPoints":[ { "xid":"DP_c0_temperature", "name":"Temp 1", "enabled":true, "loggingType":"ALL", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"AVERAGE", "purgeType":"YEARS", "pointLocator":{ "dataType":"NUMERIC", "changeType":{ "type":"NO_CHANGE", "startValue":"10" }, "settable":true }, "eventDetectors":[ ], "plotType":"SPLINE", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"IMAGE", "timePeriodType":"DAYS", "numberOfPeriods":1 }, "dataSourceXid":"DS_233ecafd-78eb-4837-98fc-8cbdb35430bc", "defaultCacheSize":1, "deviceName":"Temp Virtual", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":1, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"ANALOG", "useUnitAsSuffix":false, "suffix":"", "format":"0.00" }, "tolerance":0.0 }, { "xid":"DP_c1_temperature", "name":"Temp 2", "enabled":true, "loggingType":"ALL", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"AVERAGE", "purgeType":"YEARS", "pointLocator":{ "dataType":"NUMERIC", "changeType":{ "type":"NO_CHANGE", "startValue":"10" }, "settable":true }, "eventDetectors":[ ], "plotType":"SPLINE", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"IMAGE", "timePeriodType":"DAYS", "numberOfPeriods":1 }, "dataSourceXid":"DS_233ecafd-78eb-4837-98fc-8cbdb35430bc", "defaultCacheSize":1, "deviceName":"Temp Virtual", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":1, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"ANALOG", "useUnitAsSuffix":false, "suffix":"", "format":"0.00" }, "tolerance":0.0 }, { "xid":"DP_c2_temperature", "name":"Temp 3", "enabled":true, "loggingType":"ALL", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"AVERAGE", "purgeType":"YEARS", "pointLocator":{ "dataType":"NUMERIC", "changeType":{ "type":"NO_CHANGE", "startValue":"10" }, "settable":true }, "eventDetectors":[ ], "plotType":"SPLINE", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"IMAGE", "timePeriodType":"DAYS", "numberOfPeriods":1 }, "dataSourceXid":"DS_233ecafd-78eb-4837-98fc-8cbdb35430bc", "defaultCacheSize":1, "deviceName":"Temp Virtual", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":1, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"ANALOG", "useUnitAsSuffix":false, "suffix":"", "format":"0.00" }, "tolerance":0.0 }, { "xid":"DP_c3_temperature", "name":"Temp 4", "enabled":true, "loggingType":"ALL", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"AVERAGE", "purgeType":"YEARS", "pointLocator":{ "dataType":"NUMERIC", "changeType":{ "type":"NO_CHANGE", "startValue":"10" }, "settable":true }, "eventDetectors":[ ], "plotType":"SPLINE", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"IMAGE", "timePeriodType":"DAYS", "numberOfPeriods":1 }, "dataSourceXid":"DS_233ecafd-78eb-4837-98fc-8cbdb35430bc", "defaultCacheSize":1, "deviceName":"Temp Virtual", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":1, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"ANALOG", "useUnitAsSuffix":false, "suffix":"", "format":"0.00" }, "tolerance":0.0 }, { "xid":"DP_c4_temperature", "name":"Temp 5", "enabled":true, "loggingType":"ALL", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"INSTANT", "purgeType":"YEARS", "pointLocator":{ "dataType":"NUMERIC", "changeType":{ "type":"NO_CHANGE", "startValue":"10" }, "settable":true }, "eventDetectors":[ ], "plotType":"SPLINE", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"IMAGE", "timePeriodType":"DAYS", "numberOfPeriods":1 }, "dataSourceXid":"DS_233ecafd-78eb-4837-98fc-8cbdb35430bc", "defaultCacheSize":1, "deviceName":"Temp Virtual", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":15, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"ANALOG", "useUnitAsSuffix":false, "suffix":"", "format":"0.00" }, "tolerance":0.0 }, { "xid":"DP_dfd30a93-8ac3-40b7-aa7f-9f40b2a583a8", "name":"Trigger Point", "enabled":true, "loggingType":"ALL", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"AVERAGE", "purgeType":"YEARS", "pointLocator":{ "dataType":"NUMERIC", "changeType":{ "type":"NO_CHANGE", "startValue":"50" }, "settable":true }, "eventDetectors":[ ], "plotType":"SPLINE", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"IMAGE", "timePeriodType":"DAYS", "numberOfPeriods":1 }, "dataSourceXid":"DS_233ecafd-78eb-4837-98fc-8cbdb35430bc", "defaultCacheSize":1, "deviceName":"Temp Virtual", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":1, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"ANALOG", "useUnitAsSuffix":false, "suffix":"", "format":"0.00" }, "tolerance":0.0 } ] }
Next the scripted data source that uses these points:
{ "dataSources":[ { "xid":"DS_dba43dbb-b0bf-497a-85f4-632ce54091d0", "name":"Rodrigo's Scripted trigger", "enabled":true, "type":"SCRIPTING", "alarmLevels":{ "SCRIPT_ERROR":"URGENT", "CONTEXT_POINT_DISABLED":"IGNORE", "DATA_TYPE_ERROR":"URGENT", "POLL_ABORTED":"URGENT", "LOG_ERROR":"URGENT" }, "purgeType":"YEARS", "updatePeriods":1, "updatePeriodType":"MINUTES", "updateEvent":"UPDATE", "context":[ { "varName":"t1", "dataPointXid":"DP_c1_temperature", "updateContext":false }, { "varName":"t2", "dataPointXid":"DP_c2_temperature", "updateContext":false }, { "varName":"t3", "dataPointXid":"DP_c3_temperature", "updateContext":false }, { "varName":"t4", "dataPointXid":"DP_c4_temperature", "updateContext":false }, { "varName":"trigger", "dataPointXid":"DP_dfd30a93-8ac3-40b7-aa7f-9f40b2a583a8", "updateContext":true }, { "varName":"t0", "dataPointXid":"DP_c0_temperature", "updateContext":false } ], "logLevel":"NONE", "scriptPermissions":[ "superadmin" ], "polling":false, "executionDelaySeconds":0, "historicalSetting":false, "logCount":5, "logSize":1.0, "script":"var triggerpt = trigger.getDataPointWrapper();\r\nfor (var pnt in CONTEXT_POINTS) {\r\n var pt = this[pnt].getDataPointWrapper();\r\nprint(pt.xid===triggerpt.xid);\r\n if(pt.xid===triggerpt.xid){continue;}\r\n else{\/\/we are not amending this point!!!! Do not want an infinite loop and a breakdown.\r\n pt.runtime.set( Math.random()*100 );\r\n }\r\n }", "quantize":false, "useCron":false, "editPermission":"", "purgeOverride":false, "purgePeriod":1 } ] }
Finally, here is your event handler which is tied to an advanced scheduler which I believe you requested in another thread....
{ "advancedSchedules":[ { "xid":"ADVSCH_25f85e3d-7c2b-4b80-9a50-93571e510896", "defaultSchedule":{ "dailySchedules":[ { "changes":[ "01:55", "02:00", "02:50", "03:00", "04:00", "04:05", "04:50", "05:00", "06:00", "06:05", "07:00", "07:05", "08:05", "08:10", "08:55", "09:00", "09:55", "10:00", "11:00", "11:05", "12:00", "12:05", "12:55", "13:00", "13:55", "14:00", "15:05", "15:10" ] }, { "changes":[ "01:55", "02:00", "02:50", "03:00", "04:00", "04:05", "04:50", "05:00", "06:00", "06:05", "07:00", "07:05", "08:05", "08:10", "08:55", "09:00", "09:55", "10:00", "11:00", "11:05", "12:00", "12:05", "12:55", "13:00", "13:55", "14:00", "15:05", "15:10" ] }, { "changes":[ "01:55", "02:00", "02:50", "03:00", "04:00", "04:05", "04:50", "05:00", "06:00", "06:05", "07:00", "07:05", "08:05", "08:10", "08:55", "09:00", "09:55", "10:00", "11:00", "11:05", "12:00", "12:05", "12:55", "13:00", "13:55", "14:00", "15:05", "15:10" ] }, { "changes":[ "01:55", "02:00", "02:50", "03:00", "04:00", "04:05", "04:50", "05:00", "06:00", "06:05", "07:00", "07:05", "08:05", "08:10", "08:55", "09:00", "09:55", "10:00", "11:00", "11:05", "12:00", "12:05", "12:55", "13:00", "13:55", "14:00", "15:05", "15:10" ] }, { "changes":[ "01:55", "02:00", "02:50", "03:00", "04:00", "04:05", "04:50", "05:00", "06:00", "06:05", "07:00", "07:05", "08:05", "08:10", "08:55", "09:00", "09:55", "10:00", "11:00", "11:05", "12:00", "12:05", "12:55", "13:00", "13:55", "14:00", "15:05", "15:10" ] }, { "changes":[ "01:55", "02:00", "02:50", "03:00", "04:00", "04:05", "04:50", "05:00", "06:00", "06:05", "07:00", "07:05", "08:05", "08:10", "08:55", "09:00", "09:55", "10:00", "11:00", "11:05", "12:00", "12:05", "12:55", "13:00", "13:55", "14:00", "15:05", "15:10" ] }, { "changes":[ "01:55", "02:00", "02:50", "03:00", "04:00", "04:05", "04:50", "05:00", "06:00", "06:05", "07:00", "07:05", "08:05", "08:10", "08:55", "09:00", "09:55", "10:00", "11:00", "11:05", "12:00", "12:05", "12:55", "13:00", "13:55", "14:00", "15:05", "15:10" ] } ], "offsetCount":196 }, "readPermission":"", "name":"Rodrigo's Scheduled trigger", "alarmLevel":"IMPORTANT", "errorAlarmLevel":"DO_NOT_LOG", "user":"admin", "editPermission":"", "enabled":true, "exceptions":[ ] } ], "eventHandlers":[ { "xid":"EH_c0202c22-1684-4216-ae68-5a9bc0cb1e82", "activeAction":"STATIC_VALUE", "inactiveAction":"NONE", "handlerType":"SET_POINT", "name":"Rodrigo's Automated Trigger", "targetPointId":"DP_dfd30a93-8ac3-40b7-aa7f-9f40b2a583a8", "disabled":false, "activeValueToSet":"1", "scriptPermissions":"", "eventTypes":[ { "XID":"ADVSCH_25f85e3d-7c2b-4b80-9a50-93571e510896", "sourceType":"ADVANCED_SCHEDULE", "scheduleEventType":"SCHEDULE_ACTIVE" } ], "additionalContext":[ ] } ] }
You can amend the schedules however you like.
To show how this works manually: here is some dashboard markup:
<ma-get-point-value point-xid="DP_c0_temperature" point="pt1"></ma-get-point-value> <ma-get-point-value point-xid="DP_c1_temperature" point="pt2"></ma-get-point-value> <ma-get-point-value point-xid="DP_c2_temperature" point="pt3"></ma-get-point-value> <ma-get-point-value point-xid="DP_c3_temperature" point="pt4"></ma-get-point-value> <ma-get-point-value point-xid="DP_c4_temperature" point="pt5"></ma-get-point-value> <ma-get-point-value point-xid="DP_dfd30a93-8ac3-40b7-aa7f-9f40b2a583a8" point="trigger"></ma-get-point-value> <md-button class="md-accent md-raised md-hue-2"ng-click="oldpt1=pt1.renderedValue; oldpt2=pt2.renderedValue; oldpt3=pt3.renderedValue; oldpt4=pt4.renderedValue; oldpt5=pt5.renderedValue; trigger.setValue(1); ">HIT ME!</md-button> <md-table> <table> <tr> <th>{{pt1.name}}</th><th>{{pt2.name}}</th><th>{{pt3.name}}</th><th>{{pt4.name}}</th><th>{{pt5.name}}</th> </tr> <tr> <!-- Current Values --> <td>{{pt1.renderedValue}}</td><td>{{pt2.renderedValue}}</td><td>{{pt3.renderedValue}}</td><td>{{pt4.renderedValue}}</td><td>{{pt5.renderedValue}}</td> </tr> <!-- Previous Values --> <td>{{oldpt1}}</td><td>{{oldpt2}}</td><td>{{oldpt3}}</td><td>{{oldpt4}}</td><td>{{oldpt5}}</td> </tr> </table> </md-table>
Ok, that's all of the config for you. Please have a good look and take note at how I applied the event handler settings.
The way I implemented allows the scheduler to set the virtual trigger the same way as if you had clicked the button on the dashboard.
HOWEVER, you can use the code in the scripted datasource and all of your context points and run the script inside the handler instead. But that is entirely up to you.
Good luck!Fox
-
Thank a lot Matt! I will be trying it this week and see how it goes.
I really appreciate your help.Best,
Rodrigo -
Hi Matt,
With your help and also a little local help (my brother) I have managed to do what I wanted.
One change I did was to move the trigger from the virtual data source to the scripted data source.
Virtual Data Source + Points{ "dataSources":[ { "xid":"DS_EdificioA", "name":"Edificio A", "enabled":true, "type":"VIRTUAL", "alarmLevels":{ "POLL_ABORTED":"URGENT" }, "purgeType":"YEARS", "updatePeriods":10, "updatePeriodType":"SECONDS", "polling":true, "quantize":true, "useCron":false, "editPermission":"", "purgeOverride":false, "purgePeriod":1 } ], "dataPoints":[ { "xid":"DP_Equipo01A", "name":"ON \/ OFF (0 = ON - 1 = OFF )", "enabled":true, "loggingType":"ON_CHANGE", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"INSTANT", "purgeType":"YEARS", "pointLocator":{ "dataType":"BINARY", "changeType":{ "type":"NO_CHANGE", "startValue":"true" }, "settable":true }, "eventDetectors":[ ], "plotType":"STEP", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"TABLE", "limit":10 }, "dataSourceXid":"DS_EdificioA", "defaultCacheSize":1, "deviceName":"Equipo 01 A", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":1, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"BINARY", "oneColour":"rgb(255, 51, 51)", "oneLabel":"OFF", "zeroColour":"rgb(102, 255, 102)", "zeroLabel":"ON" }, "tolerance":0.0 }, { "xid":"DP_Equipo02A", "name":"ON \/ OFF (0 = ON - 1 = OFF )", "enabled":true, "loggingType":"ON_CHANGE", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"INSTANT", "purgeType":"YEARS", "pointLocator":{ "dataType":"BINARY", "changeType":{ "type":"NO_CHANGE", "startValue":"true" }, "settable":true }, "eventDetectors":[ ], "plotType":"STEP", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"TABLE", "limit":10 }, "dataSourceXid":"DS_EdificioA", "defaultCacheSize":1, "deviceName":"Equipo 02 A", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":15, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"BINARY", "oneColour":"rgb(255, 51, 51)", "oneLabel":"OFF", "zeroColour":"rgb(102, 255, 102)", "zeroLabel":"ON" }, "tolerance":0.0 }, { "xid":"DP_Equipo03A", "name":"ON \/ OFF (0 = ON - 1 = OFF )", "enabled":true, "loggingType":"ON_CHANGE", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"INSTANT", "purgeType":"YEARS", "pointLocator":{ "dataType":"BINARY", "changeType":{ "type":"NO_CHANGE", "startValue":"true" }, "settable":true }, "eventDetectors":[ ], "plotType":"STEP", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"TABLE", "limit":10 }, "dataSourceXid":"DS_EdificioA", "defaultCacheSize":1, "deviceName":"Equipo 03 A", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":15, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"BINARY", "oneColour":"rgb(255, 51, 51)", "oneLabel":"OFF", "zeroColour":"rgb(102, 255, 102)", "zeroLabel":"ON" }, "tolerance":0.0 }, { "xid":"DP_Equipo04A", "name":"ON \/ OFF (0 = ON - 1 = OFF )", "enabled":true, "loggingType":"ON_CHANGE", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"INSTANT", "purgeType":"YEARS", "pointLocator":{ "dataType":"BINARY", "changeType":{ "type":"NO_CHANGE", "startValue":"true" }, "settable":true }, "eventDetectors":[ ], "plotType":"STEP", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"TABLE", "limit":10 }, "dataSourceXid":"DS_EdificioA", "defaultCacheSize":1, "deviceName":"Equipo 04 A", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":15, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"BINARY", "oneColour":"rgb(255, 51, 51)", "oneLabel":"OFF", "zeroColour":"rgb(102, 255, 102)", "zeroLabel":"ON" }, "tolerance":0.0 }, { "xid":"DP_Equipo05A", "name":"ON \/ OFF (0 = ON - 1 = OFF )", "enabled":true, "loggingType":"ON_CHANGE", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"INSTANT", "purgeType":"YEARS", "pointLocator":{ "dataType":"BINARY", "changeType":{ "type":"NO_CHANGE", "startValue":"true" }, "settable":true }, "eventDetectors":[ ], "plotType":"STEP", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"TABLE", "limit":10 }, "dataSourceXid":"DS_EdificioA", "defaultCacheSize":1, "deviceName":"Equipo 05 A", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":15, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"BINARY", "oneColour":"rgb(255, 51, 51)", "oneLabel":"OFF", "zeroColour":"rgb(102, 255, 102)", "zeroLabel":"ON" }, "tolerance":0.0 } ] }
Scritped Data Source with Trigger Point
{ "dataSources":[ { "xid":"DS_ScriptEdificioA", "name":"Script Edificio A", "enabled":true, "type":"SCRIPTING", "alarmLevels":{ "SCRIPT_ERROR":"DO_NOT_LOG", "CONTEXT_POINT_DISABLED":"DO_NOT_LOG", "DATA_TYPE_ERROR":"DO_NOT_LOG", "POLL_ABORTED":"DO_NOT_LOG", "LOG_ERROR":"DO_NOT_LOG" }, "purgeType":"YEARS", "updatePeriods":5, "updatePeriodType":"SECONDS", "updateEvent":"UPDATE", "context":[ { "varName":"pt01", "dataPointXid":"DP_Equipo01A", "updateContext":false }, { "varName":"pt02", "dataPointXid":"DP_Equipo02A", "updateContext":false }, { "varName":"pt03", "dataPointXid":"DP_Equipo03A", "updateContext":false }, { "varName":"pt04", "dataPointXid":"DP_Equipo04A", "updateContext":false }, { "varName":"pt05", "dataPointXid":"DP_Equipo05A", "updateContext":false } ], "logLevel":"NONE", "scriptPermissions":[ "superadmin" ], "polling":false, "executionDelaySeconds":0, "historicalSetting":false, "logCount":5, "logSize":1.0, "script":"\/\/First: Get triggerA data.\r\nvar triggerPoint = triggerA.getDataPointWrapper();\r\n\r\n\/\/Second: For each point in CONTEXT_POINTS\r\n\/\/For example: Equipo 01 A, Equipo 02 A...\r\nfor (var contextPoint in CONTEXT_POINTS) {\r\n \r\n \/\/Third: Get the data\/status of each point.\r\n \/\/For example: Equipo 01 A data.\r\n var currentPoint = this[contextPoint].getDataPointWrapper();\r\n \r\n var triggerRuntimeValue = triggerPoint.runtime.value;\r\n \r\n if(currentPoint.xid === triggerPoint.xid) {\r\n \/\/Considering that triggerA belongs to CONTEXT_POINTS.\r\n \/\/We have to skip this one to avoid an infinite loop.\r\n continue;\r\n \r\n } else {\r\n \r\n if(triggerRuntimeValue === true) {\r\n currentPoint.runtime.set( false );\r\n \r\n } else if (triggerRuntimeValue === false) {\r\n currentPoint.runtime.set( true );\r\n }\r\n }\r\n }", "quantize":true, "useCron":false, "editPermission":"superadmin", "purgeOverride":false, "purgePeriod":1 } ], "dataPoints":[ { "xid":"DP_scriptingEdificioA", "name":"Trigger Edificio A", "enabled":true, "loggingType":"ON_CHANGE", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"INSTANT", "purgeType":"YEARS", "pointLocator":{ "dataType":"BINARY", "contextUpdate":true, "settable":true, "varName":"triggerA" }, "eventDetectors":[ ], "plotType":"STEP", "rollup":"NONE", "unit":"", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"TABLE", "limit":10 }, "dataSourceXid":"DS_ScriptEdificioA", "defaultCacheSize":1, "deviceName":"Script Edificio A (Trigger)", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":1, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"BINARY", "oneColour":"rgb(102, 255, 102)", "oneLabel":"ON", "zeroColour":"rgb(255, 51, 51)", "zeroLabel":"OFF" }, "tolerance":0.0 } ] }
Worked great!
I wanted to thank you again!
Best,
Rodrigo -
Nicely done Rod! Proud of you man!
Fox
-
:)
Thanks, my background is actually electromechanical, so this is like advance chinese translated to esperanto hahaha
I miss DGLux, the combination with Mango was very powerful, at least for my not programmer capacity. -
Feel free to message me in the future if you need any programming. Always happy to give some advice.
Fox
-
Hi @mattfox are you available for a quick chat?
-
Message sent