Skip to content

Instantly share code, notes, and snippets.

@aniline
Created June 28, 2015 10:25
Show Gist options
  • Save aniline/54061e72741135e89d5a to your computer and use it in GitHub Desktop.
Save aniline/54061e72741135e89d5a to your computer and use it in GitHub Desktop.
clip_display_flow.json
[
{
"port": "1883",
"type": "mqtt-broker",
"id": "b30f9506.0d2cf",
"clientid": "",
"broker": "localhost"
},
{
"out": [],
"in": [
{
"y": 193.44049453735352,
"x": 447.3614616394043,
"wires": [
{
"id": "51fd6852.29f4"
}
]
}
],
"type": "subflow",
"id": "6b18fb44.3e6edc",
"name": "MQDisplay"
},
{
"wires": [],
"qos": "",
"name": "Display Stuff",
"broker": "b30f9506.0d2cf",
"topic": "/leddisp1/show",
"x": 963.877197265625,
"y": 193.34521484375,
"retain": "",
"z": "6b18fb44.3e6edc",
"type": "mqtt out",
"id": "5a1dac21.eb8ab4"
},
{
"wires": [
[
"5a1dac21.eb8ab4"
]
],
"name": "Serial",
"outputs": 1,
"valid": true,
"func": "msg.payload = msg.payload.timeout + \",\" + msg.payload.option + \",\" + msg.payload.text;\nreturn msg;",
"y": 193.234130859375,
"x": 805.0994873046875,
"z": "6b18fb44.3e6edc",
"type": "function",
"id": "fde251ec.03e728"
},
{
"wires": [
[
"fde251ec.03e728"
]
],
"name": "Default settings.",
"outputs": 1,
"valid": true,
"func": "if (msg.payload.timeout === undefined)\n msg.payload.timeout = 5;\n \nif (msg.payload.option === undefined)\n msg.payload.option = 0;\n \nreturn msg;",
"y": 193.44049453735352,
"x": 606.8614616394043,
"z": "6b18fb44.3e6edc",
"type": "function",
"id": "51fd6852.29f4"
},
{
"port": "1883",
"type": "mqtt-broker",
"id": "b30f9506.0d2cf",
"clientid": "",
"broker": "localhost"
},
{
"wires": [
[
"601004f8.9b1b5c",
"20008c46.4f30ac"
]
],
"name": "Web Show Message",
"url": "/dispshow",
"id": "dced1939.06652",
"y": 62.206329345703125,
"x": 736.8175048828125,
"z": "c8955689.971af",
"type": "http in",
"method": "get"
},
{
"wires": [],
"name": "Display show resp",
"y": 63.49992370605469,
"x": 1222.2659301757812,
"z": "c8955689.971af",
"type": "http response",
"id": "2b3a66fb.60b23a"
},
{
"wires": [
[
"2b3a66fb.60b23a"
]
],
"name": "XForm",
"format": "handlebars",
"field": "payload",
"template": "<html>\n<body>\n<ul>\n<li>Requesting display of <strong>{{ payload.text }}</strong></li>\n<li>Time out set to {{ payload.timeout }} seconds.</li>\n<li>Option set to {{ payload.option }}.</li>\n</ul>\n</body>\n</html>",
"y": 63.49993896484375,
"x": 998.0912780761719,
"z": "c8955689.971af",
"type": "template",
"id": "601004f8.9b1b5c"
},
{
"wires": [
[
"2a0e1a9e.eedce6"
]
],
"name": "ShowClip",
"broker": "b30f9506.0d2cf",
"topic": "/showclip",
"y": 141.47622680664062,
"x": 590.9404296875,
"z": "c8955689.971af",
"type": "mqtt in",
"id": "92f26d68.32c8"
},
{
"wires": [
[
"20008c46.4f30ac"
]
],
"name": "",
"y": 141.25405883789062,
"x": 771.4324951171875,
"z": "c8955689.971af",
"type": "json",
"id": "2a0e1a9e.eedce6"
},
{
"repeat": "60",
"name": "Ping",
"crontab": "",
"id": "47f62f7a.f7f28",
"topic": "",
"payloadType": "date",
"wires": [
[
"b4c51f08.e6be7"
]
],
"y": 214.5794677734375,
"x": 574.3492126464844,
"z": "c8955689.971af",
"type": "inject",
"payload": "",
"once": false
},
{
"wires": [
[
"20008c46.4f30ac"
]
],
"name": "Showtime",
"outputs": 1,
"valid": true,
"func": "var d = new Date(Number(msg.payload) + 19800000);\nmsg.payload = { 'timeout' : 60, 'text' : d.getHours() + \":\" + d.getMinutes() };\nreturn msg;",
"y": 213.48410034179688,
"x": 755.1585693359375,
"z": "c8955689.971af",
"type": "function",
"id": "b4c51f08.e6be7"
},
{
"wires": [
[
"a3d01bab.f2a0e",
"56030089.3263f8"
]
],
"name": "CLIP Device",
"broker": "b30f9506.0d2cf",
"topic": "/clipdev",
"y": 356.3213806152344,
"x": 209.392822265625,
"z": "c8955689.971af",
"type": "mqtt in",
"id": "e7e2f469.ce0868"
},
{
"wires": [],
"console": "false",
"complete": "false",
"y": 432.42852783203125,
"active": true,
"x": 420.4642333984375,
"z": "c8955689.971af",
"type": "debug",
"id": "a3d01bab.f2a0e",
"name": ""
},
{
"wires": [
[
"8b3878d5.1364f",
"7f43c37f.ad81dc"
]
],
"name": "Unmarshall Number",
"outputs": 1,
"valid": true,
"func": "var memb = msg.payload.split(\",\",6);\n\nif (memb.length < 3) {\n msg.payload = {\n\t'error' : 'Error. No number',\n };\n} else {\n msg.payload = {\n\t'month' : memb[1],\n\t'day' : memb[2],\n\t'hour' : memb[3],\n\t'minute': memb[4],\n\t'number': memb[5]\n }\n}\n\nreturn msg;\n",
"y": 358.49993896484375,
"x": 444.5713806152344,
"z": "c8955689.971af",
"type": "function",
"id": "56030089.3263f8"
},
{
"wires": [],
"console": "false",
"complete": "false",
"y": 431.49993896484375,
"active": true,
"x": 919.75,
"z": "c8955689.971af",
"type": "debug",
"id": "dfdd2958.c680a",
"name": ""
},
{
"wires": [
[
"dfdd2958.c680a",
"20008c46.4f30ac"
]
],
"name": "Show Number",
"outputs": 1,
"valid": true,
"func": "if (msg.payload.number !== undefined) {\n msg.payload = { \n 'text' : msg.payload.number,\n 'option' : 1,\n 'timeout' : 10,\n };\n} else {\n msg.payload = {\n 'text' : msg.payload.error,\n 'option' : 1,\n 'timeout' : 10,\n }\n}\nreturn msg;",
"y": 357.7142333984375,
"x": 682.2500610351562,
"z": "c8955689.971af",
"type": "function",
"id": "8b3878d5.1364f"
},
{
"repeat": "",
"name": "Error",
"crontab": "",
"id": "eef46801.b9084",
"topic": "",
"payloadType": "string",
"wires": [
[
"56030089.3263f8"
]
],
"y": 236.25,
"x": 191.60711669921875,
"z": "c8955689.971af",
"type": "inject",
"payload": "1,Parse failed",
"once": false
},
{
"wires": [],
"console": "false",
"complete": "payload",
"y": 431.6070556640625,
"active": true,
"x": 686.7857055664062,
"z": "c8955689.971af",
"type": "debug",
"id": "7f43c37f.ad81dc",
"name": "Unmarshalled"
},
{
"wires": [],
"name": "MQTT Display",
"y": 172.0872802734375,
"x": 1022.3335571289062,
"z": "c8955689.971af",
"type": "subflow:6b18fb44.3e6edc",
"id": "20008c46.4f30ac"
},
{
"repeat": "",
"name": "Number",
"crontab": "",
"id": "d0d682f7.11ce18",
"topic": "",
"payloadType": "string",
"wires": [
[
"56030089.3263f8"
]
],
"y": 287.5,
"x": 191.25,
"z": "c8955689.971af",
"type": "inject",
"payload": "0,6,28,15,15,1234555222",
"once": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment