iot-camp-lab-basic-example

iot-camp-lab-basic-example

[{"id":"4dbef122.f896b","type":"function","z":"bd342fa3.b79d","name":"Fn","func":"var state = msg.payload;\n\nvar payload;\n\nswitch(state)\n{\n    case \"A\" : payload = 1;\n    break;\n    \n    case \"B\" : payload = 2;\n    break;\n    \n    case \"C\" : payload = 3;\n    break;\n    \n    case \"D\" : payload = 4;\n    break;\n}\n\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"x":537,"y":181,"wires":[["f5c9f5e5.b9c1c8"]]},{"id":"641661a0.389c9","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"A","payloadType":"str","repeat":"","crontab":"","once":false,"x":219,"y":94,"wires":[["4dbef122.f896b"]]},{"id":"8bbe9e87.9e26b","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"B","payloadType":"str","repeat":"","crontab":"","once":false,"x":220,"y":161,"wires":[["4dbef122.f896b"]]},{"id":"a7176afc.9556e8","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"C","payloadType":"str","repeat":"","crontab":"","once":false,"x":223,"y":237,"wires":[["4dbef122.f896b"]]},{"id":"4463c64c.9f6408","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"D","payloadType":"str","repeat":"","crontab":"","once":false,"x":214,"y":313,"wires":[["4dbef122.f896b"]]},{"id":"f5c9f5e5.b9c1c8","type":"debug","z":"bd342fa3.b79d","name":"","active":false,"console":"false","complete":"payload","x":903,"y":182,"wires":[]},{"id":"1629f699.2f8799","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"99","payloadType":"str","repeat":"","crontab":"","once":false,"x":215,"y":443,"wires":[["f275d18c.e7f29"]]},{"id":"a193dd6d.aee21","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"99","payloadType":"str","repeat":"","crontab":"","once":false,"x":216,"y":499,"wires":[["d2e885da.6f1fb8"]]},{"id":"f275d18c.e7f29","type":"function","z":"bd342fa3.b79d","name":"+1","func":"msg.payload = msg.payload+1;\nreturn msg;","outputs":1,"noerr":0,"x":587,"y":433,"wires":[["50c28014.c64db"]]},{"id":"b7d514e9.a8bf88","type":"function","z":"bd342fa3.b79d","name":"+1","func":"msg.payload = msg.payload+1;\nreturn msg;","outputs":1,"noerr":0,"x":589,"y":494,"wires":[["592c0c35.496e44"]]},{"id":"d2e885da.6f1fb8","type":"function","z":"bd342fa3.b79d","name":"parseFloat","func":"msg.payload = parseFloat(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":397,"y":498,"wires":[["b7d514e9.a8bf88"]]},{"id":"50c28014.c64db","type":"debug","z":"bd342fa3.b79d","name":"","active":false,"console":"false","complete":"payload","x":894,"y":435,"wires":[]},{"id":"592c0c35.496e44","type":"debug","z":"bd342fa3.b79d","name":"","active":false,"console":"false","complete":"payload","x":891,"y":496,"wires":[]},{"id":"5e3f025f.c5f35c","type":"comment","z":"bd342fa3.b79d","name":"Lab 2-1 : Netpie Input","info":"","x":184,"y":581,"wires":[]},{"id":"ce334ff9.ff2bc","type":"comment","z":"bd342fa3.b79d","name":"Lab1-2 : Payload Type","info":"","x":185,"y":389,"wires":[]},{"id":"8a6678e.a466d88","type":"comment","z":"bd342fa3.b79d","name":"Lab1-1 : Use Function","info":"","x":195,"y":34,"wires":[]},{"id":"d281d1b.0a8513","type":"debug","z":"bd342fa3.b79d","name":"","active":false,"console":"false","complete":"payload","x":880,"y":639,"wires":[]},{"id":"1f2de391.509a6c","type":"netpie-in","z":"bd342fa3.b79d","appId":"","appKey":"","appSecret":"","name":"","gearName":"lab1/#","x":233,"y":638,"wires":[["d281d1b.0a8513"]]},{"id":"91745f00.a5498","type":"comment","z":"bd342fa3.b79d","name":"Lab 2-2 : Netpie Output","info":"","x":191,"y":692,"wires":[]},{"id":"65e2c39e.d9314c","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"ON","payloadType":"str","repeat":"","crontab":"","once":false,"x":213,"y":751,"wires":[["3eef851a.ff147a"]]},{"id":"bf707b56.4d3428","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"OFF","payloadType":"str","repeat":"","crontab":"","once":false,"x":213,"y":800,"wires":[["3eef851a.ff147a"]]},{"id":"3eef851a.ff147a","type":"netpie-out","z":"bd342fa3.b79d","appId":"HelloNETPIE","appKey":"8FvId4QlaKadDe1","appSecret":"JXcGkxZjcFV3Y1GlGQsKJ2KTs","name":"","gearName":"cccc","targetGearName":"plug001","x":917,"y":769,"wires":[]},{"id":"5f205ef5.2e474","type":"debug","z":"bd342fa3.b79d","name":"","active":false,"console":"false","complete":"payload","x":886,"y":953,"wires":[]},{"id":"1e21de1a.cbfb92","type":"function","z":"bd342fa3.b79d","name":"High","func":"msg.payload =\"High\";\nreturn msg;","outputs":1,"noerr":0,"x":624,"y":988,"wires":[["5f205ef5.2e474"]]},{"id":"6855c5ef.7376ec","type":"function","z":"bd342fa3.b79d","name":"Low","func":"msg.payload = \"Low\"\nreturn msg;","outputs":1,"noerr":0,"x":624,"y":928,"wires":[["5f205ef5.2e474"]]},{"id":"4ca05a12.408554","type":"switch","z":"bd342fa3.b79d","name":">10","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"10","vt":"num"},{"t":"gte","v":"10","vt":"str"}],"checkall":"true","outputs":2,"x":439,"y":960,"wires":[["6855c5ef.7376ec"],["1e21de1a.cbfb92"]]},{"id":"3dfd2356.88290c","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"15","payloadType":"num","repeat":"","crontab":"","once":false,"x":207,"y":999,"wires":[["4ca05a12.408554"]]},{"id":"e891a5ca.484fc8","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"5","payloadType":"num","repeat":"","crontab":"","once":false,"x":211,"y":940,"wires":[["4ca05a12.408554"]]},{"id":"1302de38.177032","type":"comment","z":"bd342fa3.b79d","name":"Lab 3 : Number","info":"","x":177,"y":876,"wires":[]},{"id":"5e01d417.056d1c","type":"comment","z":"bd342fa3.b79d","name":"Lab 4 : Delay","info":"","x":166,"y":1100.9999389648438,"wires":[]},{"id":"ccf2340c.404438","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"Delay","payloadType":"str","repeat":"","crontab":"","once":false,"x":216.34027099609375,"y":1189,"wires":[["b2aaf5ff.ff5078"]]},{"id":"b2aaf5ff.ff5078","type":"delay","z":"bd342fa3.b79d","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":490,"y":1188.9998168945312,"wires":[["243d5d98.b078e2"]]},{"id":"243d5d98.b078e2","type":"debug","z":"bd342fa3.b79d","name":"","active":false,"console":"false","complete":"payload","x":888.3402709960938,"y":1184.9999389648438,"wires":[]},{"id":"ffb7ebc.1fe4b18","type":"comment","z":"bd342fa3.b79d","name":"Lab 6 : Repeat","info":"","x":172.7847137451172,"y":1263.4444580078125,"wires":[]},{"id":"918ce338.45278","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":223.7847137451172,"y":1332.4444580078125,"wires":[["fe97e223.3a01"]]},{"id":"fe97e223.3a01","type":"debug","z":"bd342fa3.b79d","name":"","active":false,"console":"false","complete":"payload","x":893.0000152587891,"y":1333,"wires":[]},{"id":"33644fb8.8d26c","type":"comment","z":"bd342fa3.b79d","name":"Lab 5 : Context","info":"","x":169.7847137451172,"y":1399.1109619140625,"wires":[]},{"id":"e04a736d.dd28","type":"inject","z":"bd342fa3.b79d","name":"","topic":"Button","payload":" ","payloadType":"str","repeat":"","crontab":"","once":false,"x":202.7847137451172,"y":1463.4444580078125,"wires":[["ade8e3bd.a8d75"]]},{"id":"ade8e3bd.a8d75","type":"function","z":"bd342fa3.b79d","name":"Context","func":"\nvar count = context.count || 0;\n\ncount += 1;\n\ncontext.count = count;\n\nmsg.payload = \"Count : \"+ context.count;\n\nreturn msg;","outputs":1,"noerr":0,"x":515.7153472900391,"y":1465.263916015625,"wires":[["2f3706f0.bd544a"]]},{"id":"2f3706f0.bd544a","type":"debug","z":"bd342fa3.b79d","name":"","active":false,"console":"false","complete":"payload","x":899.7847442626953,"y":1464.888916015625,"wires":[]},{"id":"6cd0d1a9.0acc4","type":"comment","z":"bd342fa3.b79d","name":"Lab 6 : Storage","info":"","x":169.8958282470703,"y":1538.2222900390625,"wires":[]},{"id":"e606c90f.15dda8","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":207.99993896484375,"y":1583.9998779296875,"wires":[["2ec59f34.917c9"]]},{"id":"2ec59f34.917c9","type":"file","z":"bd342fa3.b79d","name":"","filename":"/Users/Lab3/out.txt","appendNewline":true,"createDir":false,"overwriteFile":"false","x":926.9999237060547,"y":1588.9998779296875,"wires":[]},{"id":"47dde8ef.a43ba8","type":"comment","z":"bd342fa3.b79d","name":"Lab 7-1 : Send Http Get ","info":"","x":194.8958282470703,"y":1651.2222900390625,"wires":[]},{"id":"17138b9.e210274","type":"inject","z":"bd342fa3.b79d","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":207,"y":1722,"wires":[["b8fd923f.f9a19"]]},{"id":"b8fd923f.f9a19","type":"http request","z":"bd342fa3.b79d","name":"","method":"GET","ret":"txt","url":"http://www.espert.io/MySmartphone/send?key=XXXX&message={{{payload}}}","tls":"","x":909.0000457763672,"y":1716.9998779296875,"wires":[[]]},{"id":"1f6cedc9.b13072","type":"debug","z":"bd342fa3.b79d","name":"","active":false,"console":"false","complete":"payload","x":909.8957977294922,"y":1858.2222900390625,"wires":[]},{"id":"298442d4.7bd47e","type":"http request","z":"bd342fa3.b79d","name":"","method":"GET","ret":"txt","url":"http://www.espert.io/MySmartphone/send?key=XXXX&message=TOO_HOT","tls":"","x":206.00003051757812,"y":1852.9998779296875,"wires":[["1f6cedc9.b13072"]]},{"id":"f8b149a.30c30b8","type":"comment","z":"bd342fa3.b79d","name":"Lab 7-2 : Get Http Get ","info":"","x":180.8958282470703,"y":1787.5556640625,"wires":[]}]
pagongamedev

Flow Info

created 1 year, 1 month ago

Node Types

Core
  • comment (x11)
  • debug (x9)
  • delay (x1)
  • file (x1)
  • function (x7)
  • http request (x2)
  • inject (x15)
  • switch (x1)
Other
  • netpie-in (x1)
  • netpie-out (x1)

Tags

Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option