forked from CaskAle/iot-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
STSA-Workshop1-Bluemix-Flows.txt
1 lines (1 loc) · 4.19 KB
/
STSA-Workshop1-Bluemix-Flows.txt
1
[{"id":"762b80eb.397fb","type":"tab","label":"Bluemix IoT Flows"},{"id":"b2196ae3.e7946","type":"ibmiot in","z":"762b80eb.397fb","authentication":"boundService","apiKey":"","inputType":"evt","deviceId":"","applicationId":"","deviceType":"","eventType":"environment","commandType":"","format":"json","name":"IoT : environment","service":"registered","allDevices":true,"allApplications":"","allDeviceTypes":true,"allEvents":false,"allCommands":"","allFormats":false,"qos":0,"x":100,"y":80,"wires":[["b37afbf4.66a95","73373912.73de4"]]},{"id":"b37afbf4.66a95","type":"debug","z":"762b80eb.397fb","name":"debug : sensor data","active":true,"console":"false","complete":"true","x":380,"y":200,"wires":[]},{"id":"73373912.73de4","type":"function","z":"762b80eb.397fb","name":"format : environment data for DB","func":"// Format Sensor Data for dashDB\nmsg.payload = {\n SENSORID : msg.deviceId,\n TEMPERATURE : msg.payload.d.temperature,\n HUMIDITY : msg.payload.d.humidity,\n PRESSURE : msg.payload.d.pressure,\n TIMESENT : 'TIMESTAMP'\n};\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":80,"wires":[["bb5c4600.ca5d58","c17353b0.259738"]]},{"id":"bb5c4600.ca5d58","type":"debug","z":"762b80eb.397fb","name":"debug : dashDB data","active":false,"console":"false","complete":"payload","x":720,"y":140,"wires":[]},{"id":"c17353b0.259738","type":"dashDB out","z":"762b80eb.397fb","dashDB":"","service":"STSA-CaskAle-dashDB","table":"SENSEDATA","name":"dashDB","x":680,"y":80,"wires":[]},{"id":"4fea794.661c788","type":"comment","z":"762b80eb.397fb","name":"Receive IoT events from Sense Hat","info":"","x":160,"y":40,"wires":[]},{"id":"6a675d20.c10fcc","type":"ibmiot in","z":"762b80eb.397fb","authentication":"boundService","apiKey":"","inputType":"evt","deviceId":"","applicationId":"","deviceType":"","eventType":"motion","commandType":"","format":"json","name":"IoT : motion","service":"registered","allDevices":true,"allApplications":"","allDeviceTypes":true,"allEvents":false,"allCommands":"","allFormats":"","qos":0,"x":90,"y":140,"wires":[["b37afbf4.66a95"]]},{"id":"aeb98526.9e0b","type":"ibmiot in","z":"762b80eb.397fb","authentication":"boundService","apiKey":"","inputType":"evt","deviceId":"","applicationId":"","deviceType":"+","eventType":"joystick","commandType":"","format":"json","name":"IoT : joystick","service":"registered","allDevices":true,"allApplications":"","allDeviceTypes":true,"allEvents":"","allCommands":"","allFormats":"","qos":0,"x":90,"y":200,"wires":[["b37afbf4.66a95"]]},{"id":"d497960d.8638e8","type":"ibmiot out","z":"762b80eb.397fb","authentication":"boundService","apiKey":"","outputType":"cmd","deviceId":"TinySense","deviceType":"SenseHat","eventCommandType":"n/a","format":"json","data":"n/a","qos":0,"name":"IoT : commands","service":"registered","x":700,"y":320,"wires":[]},{"id":"ba7b7a6a.e0f068","type":"inject","z":"762b80eb.397fb","name":"test : alarm","topic":"alarm","payload":"navy","payloadType":"str","repeat":"","crontab":"","once":false,"x":100,"y":380,"wires":[["edcd7606.d0d42"]]},{"id":"edcd7606.d0d42","type":"function","z":"762b80eb.397fb","name":"format : command test","func":"msg.eventOrCommandType = msg.topic;\nif (msg.topic == \"alarm\") { \n msg.payload={d:{color:msg.payload}};\n}\nelse if (msg.topic == \"message\") { \n msg.payload={d:{color:\"navy\",\n background:\"black\", \n message:msg.payload}};\n}\nelse msg = null;\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":320,"wires":[["d497960d.8638e8","9ad1fceb.4b4aa8"]]},{"id":"87845c90.b8ad58","type":"inject","z":"762b80eb.397fb","name":"Turn off LED","topic":"alarm","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"x":110,"y":320,"wires":[["edcd7606.d0d42"]]},{"id":"9ad1fceb.4b4aa8","type":"debug","z":"762b80eb.397fb","name":"debug : IoT commands","active":true,"console":"false","complete":"true","x":730,"y":380,"wires":[]},{"id":"49a03550.ec123c","type":"inject","z":"762b80eb.397fb","name":"test : message","topic":"message","payload":"Z","payloadType":"str","repeat":"","crontab":"","once":false,"x":120,"y":440,"wires":[["edcd7606.d0d42"]]},{"id":"36873a8b.0ad2ce","type":"comment","z":"762b80eb.397fb","name":"Send IoT commands to Sense Hat LED Matrix","info":"","x":190,"y":280,"wires":[]}]