Skip to content

Instantly share code, notes, and snippets.

@ehkatzen
Created September 23, 2014 18:29
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 ehkatzen/e6f9016584c4770ad931 to your computer and use it in GitHub Desktop.
Save ehkatzen/e6f9016584c4770ad931 to your computer and use it in GitHub Desktop.
IoT Example

This compares the temperature of a device for dangerous levels.

[ {
"id" : "7601162e.89fee8",
"type" : "function",
"name" : "temp",
"func" : "return {payload:msg.payload.d.temp};",
"outputs" : 1,
"x" : 783.5,
"y" : 212,
"z" : "30935d2.fcf6ca2",
"wires" : [ [ "3e1f743c.c1e08c" ] ]
}, {
"id" : "3e1f743c.c1e08c",
"type" : "switch",
"name" : "temp thresh",
"property" : "payload",
"rules" : [ {
"t" : "lte",
"v" : "40"
}, {
"t" : "gt",
"v" : "40"
} ],
"checkall" : "true",
"outputs" : 2,
"x" : 932.5,
"y" : 213,
"z" : "30935d2.fcf6ca2",
"wires" : [ [ "4d14d8db.b2eb28" ], [ "f5565792.0aa9a8" ] ]
}, {
"id" : "43a6791f.bc5988",
"type" : "debug",
"name" : "cpu status",
"active" : true,
"complete" : "false",
"x" : 1243.5,
"y" : 210,
"z" : "30935d2.fcf6ca2",
"wires" : []
}, {
"id" : "bd385f48.42c7a",
"type" : "debug",
"name" : "device data",
"active" : true,
"complete" : "false",
"x" : 783.5,
"y" : 123,
"z" : "30935d2.fcf6ca2",
"wires" : []
}, {
"id" : "4d14d8db.b2eb28",
"type" : "template",
"name" : "safe",
"template" : "Temperature ({{payload}}) within safe limits",
"x" : 1096.5,
"y" : 164,
"z" : "30935d2.fcf6ca2",
"wires" : [ [ "43a6791f.bc5988" ] ]
}, {
"id" : "f5565792.0aa9a8",
"type" : "template",
"name" : "danger",
"template" : "Temperature ({{payload}}) critical",
"x" : 1095.5,
"y" : 258,
"z" : "30935d2.fcf6ca2",
"wires" : [ [ "43a6791f.bc5988" ] ]
}, {
"id" : "e5138536.1aec78",
"type" : "iot-app-in",
"name" : "IoT App In",
"topic" : "",
"x" : 579,
"y" : 202,
"z" : "30935d2.fcf6ca2",
"wires" : [ [ "bd385f48.42c7a", "7601162e.89fee8" ] ]
} ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment