{
  "custom": {
    "color": "#D3D3D3",
    "id": "0",
    "state": "Disabled"
  },
  "params": {
    "tagProps": [
      "System/SMC/Carriers/Carrier_0",
      "value",
      "value"
    ]
  },
  "propConfig": {
    "custom.color": {
      "binding": {
        "config": {
          "fallbackDelay": 2.5,
          "mode": "indirect",
          "references": {
            "0": "{view.params.tagProps[0]}",
            "fc": "{session.custom.fc}"
          },
          "tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/"
        },
        "transforms": [
          {
            "code": "\t# Perspective binding script\n\tif value is None:\n\t\treturn \u0027#000000\u0027\n\t\n\t# Unwrap possible {\u0027value\u0027: {...}} wrapper\n\td \u003d value.get(\u0027value\u0027, value) if isinstance(value, dict) else value\n\t\n\t# --- tag -\u003e priority (exact names, case-sensitive) ---\n\tprio \u003d {\n\t\t\u0027Disabled\u0027: 11,\n\t\t\u0027Needs_Update\u0027: 5,\n\t\t\u0027Blocked\u0027: 11,\n\t\t\u0027Common_Fault\u0027: 2,\n\t\t\u0027CCT_Communication_to_Carrier\u0027: 5,\n\t\t\u0027Possible_TCB_MCB_Error\u0027: 2,\n\t\t\u0027Not_Checked_at_Last_CTB_CRB\u0027: 2,\n\t\t\u0027Communication_Error\u0027: 2,\n\t\t\u0027Status_OK\u0027: 9,\n\t\t\u0027Current_Limit_Exceeded\u0027: 2,\n\t\t\u0027Motor_Not_Running\u0027: 9,\n\t\t\u0027Calibration_Error\u0027: 2,\n\t\t\u0027Default_Configuration\u0027: 5,\n\t\t\u0027Programming_Mode\u0027: 5,\n\t\t\u0027Item_Overhanging_Belt_Fault\u0027: 2,\n\t\t\u0027Current_Collector_Fault\u0027: 2,\n\t\t\u0027Item_Too_High\u0027: 2,\n\t\t\u0027Item_Too_Wide\u0027: 2,\n\t\t\u0027Item_on_Activated_Carrier\u0027: 2,\n\t\t\u0027Deflected_Bellows_Fault\u0027: 2,\n\t\t\u0027Double_Maximum_Recirculation\u0027: 10,\n\t\t\u0027CCT_Download_Done\u0027: 5,\n\t\t\u0027Item_on_Bellows_Warning\u0027: 2,\n\t\t\u0027Item_on_Bellows_Is_Active\u0027: 2,\n\t}\n\t\n\t# --- priority -\u003e color ---\n\tp2c \u003d {\n\t\t1:  \u0027#808080\u0027,\n\t\t2:  \u0027#FF0000\u0027,\n\t\t3:  \u0027#FF8C00\u0027,\n\t\t4:  \u0027#D900D9\u0027,\n\t\t5:  \u0027#AC5F00\u0027,\n\t\t6:  \u0027#0000FF\u0027,\n\t\t7:  \u0027#FFFF00\u0027,\n\t\t8:  \u0027#008000\u0027,\n\t\t9:  \u0027#CCFFCC\u0027,\n\t\t10: \u0027#87CEFA\u0027,\n\t\t11: \u0027#D3D3D3\u0027,\n\t\t12: \u0027#FFFFFF\u0027,\n\t}\n\t\n\t# Find the lowest (highest severity) priority among active tags\n\tactive_min \u003d None\n\tfor k, v in (d.items() if hasattr(d, \u0027items\u0027) else []):\n\t\tif v and k in prio:\n\t\t\tp \u003d prio[k]\n\t\t\tactive_min \u003d p if active_min is None else min(active_min, p)\n\t\n\t# Fallback color if nothing matched\n\tif active_min is None:\n\t\treturn \u0027#000000\u0027\n\t\n\treturn p2c.get(active_min, \u0027#000000\u0027)",
            "type": "script"
          }
        ],
        "type": "tag"
      },
      "persistent": true
    },
    "custom.id": {
      "binding": {
        "config": {
          "fallbackDelay": 2.5,
          "mode": "indirect",
          "references": {
            "0": "{view.params.tagProps[0]}",
            "fc": "{session.custom.fc}"
          },
          "tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/Parameters/CarrierNumber"
        },
        "type": "tag"
      },
      "persistent": true
    },
    "custom.state": {
      "binding": {
        "config": {
          "fallbackDelay": 2.5,
          "mode": "indirect",
          "references": {
            "0": "{view.params.tagProps[0]}",
            "fc": "{session.custom.fc}"
          },
          "tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/"
        },
        "transforms": [
          {
            "code": "\t# Perspective binding script: return highest-priority active STATE (label)\n\t\n\tif value is None:\n\t\treturn \"No Data\"\n\t\n\t# Unwrap possible {\u0027value\u0027: {...}}\n\td \u003d value.get(\u0027value\u0027, value) if isinstance(value, dict) else value\n\t\n\t# tag -\u003e (priority, label)   # lowest number \u003d highest priority\n\tmeta \u003d {\n\t\t\u0027Disabled\u0027: (11, \u0027Disabled\u0027),\n\t\t\u0027Needs_Update\u0027: (5, \u0027Needs update\u0027),\n\t\t\u0027Blocked\u0027: (11, \u0027Blocked\u0027),\n\t\t\u0027Common_Fault\u0027: (2, \u0027Common fault\u0027),\n\t\t\u0027CCT_Communication_to_Carrier\u0027: (5, \u0027CCT communication to carrier\u0027),\n\t\t\u0027Possible_TCB_MCB_Error\u0027: (2, \u0027Possible TCB/MCB error. No activation on carrier\u0027),\n\t\t\u0027Not_Checked_at_Last_CTB_CRB\u0027: (2, \u0027Not checked at last CTB/CRB\u0027),\n\t\t\u0027Communication_Error\u0027: (2, \u0027Communication error\u0027),\n\t\t\u0027Status_OK\u0027: (9, \u0027Status OK\u0027),\n\t\t\u0027Current_Limit_Exceeded\u0027: (2, \u0027Current limit exceeded\u0027),\n\t\t\u0027Motor_Not_Running\u0027: (9, \u0027Motor not running\u0027),\n\t\t\u0027Calibration_Error\u0027: (2, \u0027Calibration error\u0027),\n\t\t\u0027Default_Configuration\u0027: (5, \u0027Default configuration\u0027),\n\t\t\u0027Programming_Mode\u0027: (5, \u0027Programming mode\u0027),\n\t\t\u0027Item_Overhanging_Belt_Fault\u0027: (2, \u0027Item overhanging belt fault\u0027),\n\t\t\u0027Current_Collector_Fault\u0027: (2, \u0027Current collector fault\u0027),\n\t\t\u0027Item_Too_High\u0027: (2, \u0027Item too high\u0027),\n\t\t\u0027Item_Too_Wide\u0027: (2, \u0027Item too wide\u0027),\n\t\t\u0027Item_on_Activated_Carrier\u0027: (2, \u0027Item on activated carrier\u0027),\n\t\t\u0027Deflected_Bellows_Fault\u0027: (2, \u0027Deflected bellows fault\u0027),\n\t\t\u0027Double_Maximum_Recirculation\u0027: (10, \u0027Double maximum recirculation\u0027),\n\t\t\u0027CCT_Download_Done\u0027: (5, \u0027CCT download done\u0027),\n\t\t\u0027Item_on_Bellows_Warning\u0027: (2, \u0027Item on bellows warning\u0027),\n\t\t\u0027Item_on_Bellows_Is_Active\u0027: (2, \u0027Item on bellows is active\u0027),\n\t}\n\t\n\t# Deterministic tie-break order (within the same priority)\n\torder \u003d [\n\t\t# prio 2 group (faults)\n\t\t\u0027Common_Fault\u0027,\u0027Communication_Error\u0027,\u0027Possible_TCB_MCB_Error\u0027,\u0027Not_Checked_at_Last_CTB_CRB\u0027,\n\t\t\u0027Current_Limit_Exceeded\u0027,\u0027Calibration_Error\u0027,\u0027Item_Overhanging_Belt_Fault\u0027,\u0027Current_Collector_Fault\u0027,\n\t\t\u0027Item_Too_High\u0027,\u0027Item_Too_Wide\u0027,\u0027Item_on_Activated_Carrier\u0027,\u0027Deflected_Bellows_Fault\u0027,\n\t\t\u0027Item_on_Bellows_Warning\u0027,\u0027Item_on_Bellows_Is_Active\u0027,\n\t\t# prio 5 group\n\t\t\u0027Needs_Update\u0027,\u0027CCT_Communication_to_Carrier\u0027,\u0027Default_Configuration\u0027,\u0027Programming_Mode\u0027,\u0027CCT_Download_Done\u0027,\n\t\t# prio 9 group\n\t\t\u0027Status_OK\u0027,\u0027Motor_Not_Running\u0027,\n\t\t# prio 10\n\t\t\u0027Double_Maximum_Recirculation\u0027,\n\t\t# prio 11\n\t\t\u0027Disabled\u0027,\u0027Blocked\u0027,\n\t]\n\t\n\t# Collect active tags that we know about\n\tactive \u003d []\n\tif hasattr(d, \u0027items\u0027):\n\t\tfor k, v in d.items():\n\t\t\tif v and k in meta:\n\t\t\t\tactive.append(k)\n\t\n\tif not active:\n\t\treturn \"None Active\"\n\t\n\t# Choose the one with the smallest priority; if tie, use \u0027order\u0027 sequence\n\tbest \u003d min(active, key\u003dlambda k: (meta[k][0], order.index(k) if k in order else 999))\n\treturn meta[best][1]",
            "type": "script"
          }
        ],
        "type": "tag"
      },
      "persistent": true
    },
    "params.tagProps": {
      "paramDirection": "input",
      "persistent": true
    }
  },
  "props": {
    "defaultSize": {
      "height": 40,
      "width": 40
    }
  },
  "root": {
    "children": [
      {
        "meta": {
          "name": "RunningStatus"
        },
        "position": {
          "grow": 1
        },
        "propConfig": {
          "position.rotate.angle": {
            "binding": {
              "config": {
                "path": "view.params.directionLeft"
              },
              "transforms": [
                {
                  "expression": "if({value}, \u0027180deg\u0027, \u00270deg\u0027)",
                  "type": "expression"
                }
              ],
              "type": "property"
            }
          },
          "props.elements[0].fill.paint": {
            "binding": {
              "config": {
                "path": "view.custom.color"
              },
              "type": "property"
            }
          },
          "props.elements[1].fill": {
            "binding": {
              "config": {
                "path": "view.custom.color"
              },
              "transforms": [
                {
                  "expression": "if({value}\u003d\"#808080\",\"#000000\",\r\nif({value}\u003d\"#FF0000\",\"#FFFFFF\",\r\nif({value}\u003d\"#FF8C00\",\"#000000\",\r\nif({value}\u003d\"#D900D9\",\"#FFFFFF\",\r\nif({value}\u003d\"#AC5F00\",\"#FFFFFF\",\r\nif({value}\u003d\"#0000FF\",\"#FFFFFF\",\r\nif({value}\u003d\"#FFFF00\",\"#000000\",\r\nif({value}\u003d\"#008000\",\"#FFFFFF\",\r\nif({value}\u003d\"#CCFFCC\",\"#000000\",\r\nif({value}\u003d\"#87CEFA\",\"#000000\",\r\nif({value}\u003d\"#D3D3D3\",\"#000000\",\r\nif({value}\u003d\"#FFFFFF\",\"#000000\",\r\n\"#FFFFFF\"))))))))))))\r\n",
                  "type": "expression"
                }
              ],
              "type": "property"
            }
          },
          "props.elements[1].text": {
            "binding": {
              "config": {
                "path": "view.custom.id"
              },
              "type": "property"
            }
          }
        },
        "props": {
          "elements": [
            {
              "d": "M37,12\nC40.333333,12 42,13.666667 42,17\nL42,37\nC42,40.333333 40.333333,42 37,42\nL17,42\nC13.666667,42 12,40.333333 12,37\nL12,17\nC12,13.666667 13.666667,12 17,12\nZ\n",
              "fill": {},
              "name": "path",
              "stroke": {
                "paint": "#4c4c4c",
                "width": 3
              },
              "type": "path"
            },
            {
              "style": {
                "classes": "",
                "dominantBaseline": "middle",
                "fontSize": 10,
                "fontWeight": "bolder",
                "textAnchor": "middle"
              },
              "type": "text",
              "x": 27,
              "y": 27
            }
          ],
          "style": {
            "overflow": "hidden"
          },
          "viewBox": "0 0 54 54"
        },
        "type": "ia.shapes.svg"
      }
    ],
    "meta": {
      "name": "root",
      "tooltip": {
        "enabled": true,
        "style": {
          "classes": "Alarms-Styles/NoAlarm"
        }
      }
    },
    "propConfig": {
      "meta.tooltip.text": {
        "binding": {
          "config": {
            "expression": "if(\r\n    {view.custom.color} !\u003d \"#000000\",\r\n    \"Source Id: \" + {view.params.tagProps[0]} + \", State: \" + {view.custom.state},\r\n    \"Device Disconnected\"\r\n)\r\n"
          },
          "type": "expr"
        }
      }
    },
    "props": {
      "direction": "column",
      "justify": "center"
    },
    "type": "ia.container.flex"
  }
}