{ "custom": { "name": "CRAH-123", "status": "Disabled" }, "params": { "rowData": { "Name": "CRAH-123", "State": "Disabled" }, "server": "value" }, "propConfig": { "custom.name": { "binding": { "config": { "path": "view.params.rowData" }, "transforms": [ { "code": "\treturn value[\u0027Name\u0027]", "type": "script" } ], "type": "property" }, "persistent": true }, "custom.status": { "binding": { "config": { "path": "view.params.rowData" }, "transforms": [ { "code": "\treturn value[\u0027State\u0027]", "type": "script" } ], "type": "property" }, "persistent": true }, "params.rowData": { "paramDirection": "input", "persistent": true }, "params.server": { "paramDirection": "input", "persistent": true } }, "props": { "defaultSize": { "height": 26, "width": 177 } }, "root": { "children": [ { "events": { "dom": { "onClick": { "config": { "script": "\tstringName \u003d self.view.params.server\n\tremoteGatewayName \u003d [stringName] # As configured in the Gateway Network\n\tdeviceName \u003d self.view.custom.name # The name of the device on the remote gateway\n\tenableDevice \u003d True # Or False to disable\n\t\n\tpayload \u003d {\n\t \"deviceName\": deviceName,\n\t \"enabled\": enableDevice\n\t}\n\t\n\ttry:\n\t system.util.sendMessage(\n\t project\u003d\"global\", # Optional, but good practice if handler is project-specific\n\t messageHandler\u003d\"DeviceControl\", # Must match the message handler name on the remote gateway\n\t payload\u003dpayload,\n\t scope\u003d\"G\", # Gateway scope for remote execution\n\t remoteServers\u003dremoteGatewayName\n\t )\n\t msg \u003d \"Sent request to \u0027\"+ remoteGatewayName +\"\u0027 to set device \u0027\"+ deviceName +\"\u0027 to enabled\u003d\"+ str(enableDevice) +\".\"\n\t system.util.getLogger(\"LocalDeviceControl\").info(msg)\n\texcept Exception as e:\n\t\tmsg \u003d \"Error sending message to remote gateway: \" + str(e)\n\t\tsystem.util.getLogger(\"LocalDeviceControl\").error(msg)" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Button" }, "position": { "basis": "80px" }, "propConfig": { "props.primary": { "binding": { "config": { "path": "view.custom.status" }, "enabled": false, "transforms": [ { "fallback": true, "inputType": "scalar", "mappings": [ { "input": "Disabled", "output": false } ], "outputType": "scalar", "type": "map" } ], "type": "property" } } }, "props": { "primary": false, "text": "Enable" }, "type": "ia.input.button" }, { "events": { "dom": { "onClick": { "config": { "script": "\tstringName \u003d self.view.params.server\n\tremoteGatewayName \u003d [stringName] # As configured in the Gateway Network\n\tdeviceName \u003d self.view.custom.name # The name of the device on the remote gateway\n\tenableDevice \u003d False # Or False to disable\n\t\n\tpayload \u003d {\n\t \"deviceName\": deviceName,\n\t \"enabled\": enableDevice\n\t}\n\t\n\ttry:\n\t system.util.sendMessage(\n\t project\u003d\"global\", # Optional, but good practice if handler is project-specific\n\t messageHandler\u003d\"DeviceControl\", # Must match the message handler name on the remote gateway\n\t payload\u003dpayload,\n\t scope\u003d\"G\", # Gateway scope for remote execution\n\t remoteServers\u003d remoteGatewayName\n\t )\n\t msg \u003d \"Sent request to \u0027\"+ remoteGatewayName +\"\u0027 to set device \u0027\"+ deviceName +\"\u0027 to enabled\u003d\"+ str(enableDevice) +\".\"\n\t system.util.getLogger(\"LocalDeviceControl\").info(msg)\n\texcept Exception as e:\n\t\tmsg \u003d \"Error sending message to remote gateway: \" + str(e)\n\t\tsystem.util.getLogger(\"LocalDeviceControl\").error(msg)" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Button_0" }, "position": { "basis": "80px" }, "propConfig": { "props.primary": { "binding": { "config": { "path": "view.params.rowData.State" }, "enabled": false, "transforms": [ { "fallback": false, "inputType": "scalar", "mappings": [ { "input": "Disabled", "output": true } ], "outputType": "scalar", "type": "map" } ], "type": "property" } } }, "props": { "primary": false, "text": "Disabled" }, "type": "ia.input.button" } ], "meta": { "name": "root" }, "props": { "style": { "gap": "5px", "paddingLeft": "5px", "paddingRight": "5px" } }, "type": "ia.container.flex" } }