264 lines
6.9 KiB
Plaintext
264 lines
6.9 KiB
Plaintext
{
|
|
"custom": {
|
|
"state": 0,
|
|
"string": "Clear"
|
|
},
|
|
"params": {
|
|
"tagProps": [
|
|
3,
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value"
|
|
]
|
|
},
|
|
"propConfig": {
|
|
"custom.state": {
|
|
"binding": {
|
|
"config": {
|
|
"fallbackDelay": 1,
|
|
"mode": "indirect",
|
|
"references": {
|
|
"0": "{view.params.tagProps[0]}",
|
|
"fc": "{session.custom.fc}"
|
|
},
|
|
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/State"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"expression": "coalesce({value},0)",
|
|
"type": "expression"
|
|
}
|
|
],
|
|
"type": "tag"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"custom.string": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.state"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"fallback": "Clear",
|
|
"inputType": "scalar",
|
|
"mappings": [
|
|
{
|
|
"input": 1,
|
|
"output": "Clear"
|
|
},
|
|
{
|
|
"input": 2,
|
|
"output": "Blocked"
|
|
},
|
|
{
|
|
"input": 3,
|
|
"output": "Disabled"
|
|
},
|
|
{
|
|
"input": 4,
|
|
"output": "Jammed"
|
|
}
|
|
],
|
|
"outputType": "scalar",
|
|
"type": "map"
|
|
}
|
|
],
|
|
"type": "property"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"params.tagProps": {
|
|
"paramDirection": "input",
|
|
"persistent": true
|
|
}
|
|
},
|
|
"props": {
|
|
"defaultSize": {
|
|
"height": 42,
|
|
"width": 98
|
|
}
|
|
},
|
|
"root": {
|
|
"children": [
|
|
{
|
|
"meta": {
|
|
"name": "Photoeye"
|
|
},
|
|
"position": {
|
|
"height": 1,
|
|
"width": 1
|
|
},
|
|
"propConfig": {
|
|
"props.elements[0].fill.paint": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.state"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"fallback": "#00FF00",
|
|
"inputType": "scalar",
|
|
"mappings": [
|
|
{
|
|
"input": 0,
|
|
"output": "#00FF00"
|
|
},
|
|
{
|
|
"input": 2,
|
|
"output": "#000000"
|
|
},
|
|
{
|
|
"input": 3,
|
|
"output": "#800080"
|
|
},
|
|
{
|
|
"input": 4,
|
|
"output": "#FF0000"
|
|
}
|
|
],
|
|
"outputType": "color",
|
|
"type": "map"
|
|
}
|
|
],
|
|
"type": "property"
|
|
}
|
|
},
|
|
"props.elements[2].fill.paint": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.state"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"fallback": "#00FF00",
|
|
"inputType": "scalar",
|
|
"mappings": [
|
|
{
|
|
"input": 0,
|
|
"output": "#00FF00"
|
|
},
|
|
{
|
|
"input": 2,
|
|
"output": "#000000"
|
|
},
|
|
{
|
|
"input": 3,
|
|
"output": "#800080"
|
|
},
|
|
{
|
|
"input": 4,
|
|
"output": "#FF0000"
|
|
}
|
|
],
|
|
"outputType": "color",
|
|
"type": "map"
|
|
}
|
|
],
|
|
"type": "property"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"elements": [
|
|
{
|
|
"d": "m 28.763932,20 -20,10 V 10 Z",
|
|
"fill": {},
|
|
"name": "path",
|
|
"stroke": {
|
|
"paint": "#000000",
|
|
"width": "2"
|
|
},
|
|
"type": "path"
|
|
},
|
|
{
|
|
"stroke": {
|
|
"paint": "#000000",
|
|
"width": "2"
|
|
},
|
|
"stroke-dasharray": "4,4",
|
|
"type": "line",
|
|
"x1": "30",
|
|
"x2": "60",
|
|
"y1": "20",
|
|
"y2": "20"
|
|
},
|
|
{
|
|
"fill": {},
|
|
"height": "20",
|
|
"stroke": {
|
|
"paint": "#000000",
|
|
"width": "2"
|
|
},
|
|
"type": "rect",
|
|
"width": "6",
|
|
"x": "60",
|
|
"y": "10"
|
|
}
|
|
],
|
|
"preserveAspectRatio": "none",
|
|
"style": {
|
|
"boxShadow": "value"
|
|
},
|
|
"viewBox": "0 0 80 40"
|
|
},
|
|
"type": "ia.shapes.svg"
|
|
}
|
|
],
|
|
"events": {
|
|
"dom": {
|
|
"onClick": {
|
|
"config": {
|
|
"script": "\tsystem.perspective.openDock(\u0027Docked-East-Photoeye\u0027,params\u003d{\u0027tagProps\u0027:self.view.params.tagProps})"
|
|
},
|
|
"scope": "G",
|
|
"type": "script"
|
|
},
|
|
"onMouseEnter": {
|
|
"config": {
|
|
"script": "\tfrom time import sleep\n\n\talarm \u003d []\n\tmessage \u003d None\n\n\tsleep(0.5)\n\n\tif system.tag.exists(\"System/aws_data\"):\n\t\tif self.view.params.tagProps[0] !\u003d \"\":\n\t\t\ttags_to_read \u003d system.tag.readBlocking(\"System/aws_data\")\n\t\t\tdecode_alarm_data \u003d system.util.jsonDecode(tags_to_read[0].value)\n\t\t\talarm \u003d [decode_alarm_data[i] for i in decode_alarm_data\n\t\t\t\t\tif decode_alarm_data[i][\u0027sourceId\u0027].startswith(self.view.params.tagProps[0])]\n\t\tif alarm:\n\t\t\talarm \u003d sorted(alarm, key \u003d lambda t:t[\u0027timestamp\u0027], reverse\u003dTrue)\n\t\t\tmessage \u003d max(alarm, key \u003d lambda p:p[\u0027priority\u0027]).get(\u0027message\u0027)\n\t\t\tif len(alarm) \u003e 1:\n\t\t\t\tmessage +\u003d \" (+\" + str(len(alarm)-1) + \")\"\n\tself.view.custom.alarm_message \u003d message"
|
|
},
|
|
"scope": "G",
|
|
"type": "script"
|
|
}
|
|
}
|
|
},
|
|
"meta": {
|
|
"name": "root",
|
|
"tooltip": {
|
|
"enabled": true
|
|
}
|
|
},
|
|
"propConfig": {
|
|
"meta.tooltip.text": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "\"Source Id: \" + {view.params.tagProps[0]} + \", Status: \" + {view.custom.string}\n"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
},
|
|
"meta.visible": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "session.custom.alarm_filter.show_photoeyes"
|
|
},
|
|
"type": "property"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"mode": "percent",
|
|
"style": {
|
|
"cursor": "pointer"
|
|
}
|
|
},
|
|
"type": "ia.container.coord"
|
|
}
|
|
} |