Skip to content

Instantly share code, notes, and snippets.

@ethanpierce
Last active August 7, 2019 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethanpierce/3c368f90c1f2c96f378ed356d9d9b3c7 to your computer and use it in GitHub Desktop.
Save ethanpierce/3c368f90c1f2c96f378ed356d9d9b3c7 to your computer and use it in GitHub Desktop.
Rules Engine Event submission
[
{
"id": "b69a84fc.80a2b8",
"type": "subflow",
"name": "Log Error (3)",
"info": "This sub flow will log an error to the ManageDevices FileMaker applicaiton on the solarsync.io FileMaker Server.",
"category": "Error Handling",
"in": [
{
"x": 60,
"y": 40,
"wires": [
{
"id": "917c47b5.69f9a8"
},
{
"id": "83351100.c6e2a"
}
]
}
],
"out": [
{
"x": 360,
"y": 40,
"wires": [
{
"id": "b69a84fc.80a2b8",
"port": 0
}
]
}
]
},
{
"id": "4dab9f24.ac3f48",
"type": "catch",
"z": "b69a84fc.80a2b8",
"name": "Catch Error Logging Issue",
"scope": [
"65c61488.62202c",
"9adeb8e3.5b0c68",
"56132c65.8cb284"
],
"x": 270,
"y": 140,
"wires": [
[
"917c47b5.69f9a8"
]
]
},
{
"id": "56132c65.8cb284",
"type": "dapi-create-record",
"z": "b69a84fc.80a2b8",
"name": "Create Error Log Entry",
"client": "",
"layout": "Log API",
"layoutType": "str",
"data": "error",
"dataType": "msg",
"scripts": "",
"scriptsType": "none",
"merge": "false",
"mergeType": "bool",
"output": "payload",
"x": 720,
"y": 40,
"wires": [
[]
]
},
{
"id": "9adeb8e3.5b0c68",
"type": "function",
"z": "b69a84fc.80a2b8",
"name": "Create Error Log",
"func": "msg.error = {\n error: msg.error,\n payload: msg.payload\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 500,
"y": 40,
"wires": [
[
"56132c65.8cb284"
]
]
},
{
"id": "917c47b5.69f9a8",
"type": "function",
"z": "b69a84fc.80a2b8",
"name": "Send Error Message",
"func": "msg.payload = msg.error.message\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 520,
"y": 100,
"wires": [
[
"8568b987.2612a"
]
]
},
{
"id": "8568b987.2612a",
"type": "debug",
"z": "b69a84fc.80a2b8",
"name": "Log Error",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 769.5,
"y": 100,
"wires": []
},
{
"id": "83351100.c6e2a",
"type": "debug",
"z": "b69a84fc.80a2b8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 540,
"y": 280,
"wires": []
},
{
"id": "1ea6c402.a97d2c",
"type": "tab",
"label": "IOT Event Subscription",
"disabled": false,
"info": ""
},
{
"id": "12061299.a1ff7d",
"type": "debug",
"z": "1ea6c402.a97d2c",
"name": "Log Result",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 1270,
"y": 80,
"wires": []
},
{
"id": "ac22be15.1b5a8",
"type": "dapi-create-record",
"z": "1ea6c402.a97d2c",
"name": "",
"client": "",
"layout": "layout",
"layoutType": "msg",
"data": "payload",
"dataType": "msg",
"scripts": "",
"scriptsType": "none",
"merge": "true",
"mergeType": "bool",
"output": "payload",
"x": 1020,
"y": 100,
"wires": [
[
"12061299.a1ff7d"
]
]
},
{
"id": "13cd355c.bfc09b",
"type": "change",
"z": "1ea6c402.a97d2c",
"name": "Set Layout Context And Create Payload",
"rules": [
{
"t": "set",
"p": "layout",
"pt": "msg",
"to": "Event API",
"tot": "str"
},
{
"t": "set",
"p": "data",
"pt": "msg",
"to": "payload",
"tot": "msg"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{}",
"tot": "json"
},
{
"t": "set",
"p": "payload.coreid",
"pt": "msg",
"to": "device",
"tot": "msg"
},
{
"t": "set",
"p": "payload.data",
"pt": "msg",
"to": "data",
"tot": "msg"
},
{
"t": "set",
"p": "payload.name",
"pt": "msg",
"to": "event",
"tot": "msg"
},
{
"t": "set",
"p": "payload.published_at",
"pt": "msg",
"to": "published_at",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 80,
"wires": [
[
"ac22be15.1b5a8"
]
]
},
{
"id": "13d2a559.67111b",
"type": "catch",
"z": "1ea6c402.a97d2c",
"name": "",
"scope": null,
"x": 220,
"y": 140,
"wires": [
[
"c639f18c.86891"
]
]
},
{
"id": "c639f18c.86891",
"type": "subflow:b69a84fc.80a2b8",
"z": "1ea6c402.a97d2c",
"name": "",
"x": 760,
"y": 140,
"wires": [
[
"f181d448.e452d8"
]
]
},
{
"id": "f181d448.e452d8",
"type": "debug",
"z": "1ea6c402.a97d2c",
"name": "Log Error",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 1240,
"y": 140,
"wires": []
},
{
"id": "139d8649.37d34a",
"type": "inject",
"z": "1ea6c402.a97d2c",
"name": "",
"topic": "",
"payload": "{}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 550,
"y": 300,
"wires": [
[
"ac22be15.1b5a8"
]
]
},
{
"id": "548b436d.da357c",
"type": "particle-subscribe",
"z": "1ea6c402.a97d2c",
"name": "",
"auth": "",
"scope": "user",
"product": "",
"event": "environment/latest",
"device": "",
"x": 300,
"y": 80,
"wires": [
[
"13cd355c.bfc09b"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment