-
Notifications
You must be signed in to change notification settings - Fork 2
/
aispeaker-flow-edge.json
executable file
·1 lines (1 loc) · 8.11 KB
/
aispeaker-flow-edge.json
1
[{"id":"c16181d6.06bad","type":"exec","z":"4b32a8dc.cdbb48","command":"aplay /home/pi/temp/in.wav","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Voice Output","x":954.1344909667969,"y":132.3288631439209,"wires":[[],[],[]]},{"id":"25468640.ba0cda","type":"file","z":"4b32a8dc.cdbb48","name":"Create WAV","filename":"/home/pi/temp/in.wav","appendNewline":false,"createDir":true,"overwriteFile":"true","x":795.8664569854736,"y":90.53615188598633,"wires":[]},{"id":"e56a1343.777ab","type":"delay","z":"4b32a8dc.cdbb48","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":794.3410511016846,"y":131.99090957641602,"wires":[["c16181d6.06bad"]]},{"id":"ebcfdf5c.08801","type":"function","z":"4b32a8dc.cdbb48","name":"OFF","func":"msg.payload = 1;\nreturn msg;","outputs":1,"noerr":0,"x":530.0001182556152,"y":476.0000514984131,"wires":[["156bd0d6.bce0df"]]},{"id":"fd67dc40.5870f","type":"rpi-gpio out","z":"4b32a8dc.cdbb48","name":"SW1","pin":"7","set":true,"level":"1","freq":"","out":"out","x":829.9999618530273,"y":235.33352088928223,"wires":[]},{"id":"657ea6a5.78f4f8","type":"function","z":"4b32a8dc.cdbb48","name":"ON","func":"var dt = new Date();\nvar min1 = dt.getHours()*60 + dt.getMinutes();\n\nvar array = msg.payload.c.time.split(\":\");\nvar min2 = parseInt(array[0]*60,10) + parseInt(array[1],10);\n\nvar diff = min2 - min1;\nif(diff < -5){\n diff += (24 * 60);\n}else if(-5 <= diff && diff < 0){\n diff = 0;\n}\n\nmsg.delay = diff * 60 * 1000;\n\n\nswitch( msg.payload.c.temperature ) {\n case '18':\n msg.sw_no = 1;\n node.warn('***18度***');\n break;\n case '19':\n msg.sw_no = 2;\n node.warn('***19度***');\n break; \n case '20':\n msg.sw_no = 3;\n node.warn('***20度***');\n break; \n case '21':\n msg.sw_no = 4;\n node.warn('***21度***');\n break;\n case '22':\n msg.sw_no = 5;\n node.warn('***22度***');\n break;\n case '23':\n msg.sw_no = 6;\n node.warn('***23度***');\n break;\n case '24':\n msg.sw_no = 7;\n node.warn('***24度***');\n break; \n case '25':\n msg.sw_no = 8;\n node.warn('***25度***');\n break;\n case '26':\n msg.sw_no = 9;\n node.warn('***26度***');\n break;\n default:\n msg.sw_no = 10;\n node.warn('***OFF***');\n break;\n}\n\nmsg.payload = 0;\nreturn msg;","outputs":1,"noerr":0,"x":215.9999542236328,"y":425.999981880188,"wires":[["b94039dd.9529b8"]]},{"id":"7e0d51ea.965c4","type":"rpi-gpio out","z":"4b32a8dc.cdbb48","name":"SW2","pin":"11","set":"","level":"0","freq":"","out":"out","x":829.9999580383301,"y":283.33348655700684,"wires":[]},{"id":"41206621.011758","type":"rpi-gpio out","z":"4b32a8dc.cdbb48","name":"SW3","pin":"13","set":"","level":"0","freq":"","out":"out","x":830.9999542236328,"y":331.33349418640137,"wires":[]},{"id":"34e7f813.0e5408","type":"rpi-gpio out","z":"4b32a8dc.cdbb48","name":"SW4","pin":"12","set":"","level":"0","freq":"","out":"out","x":830.9999542236328,"y":377.3335132598877,"wires":[]},{"id":"4a45d4c9.04f3bc","type":"rpi-gpio out","z":"4b32a8dc.cdbb48","name":"SW5","pin":"29","set":"","level":"0","freq":"","out":"out","x":829.9999580383301,"y":423.33349323272705,"wires":[]},{"id":"1a780c59.3f69f4","type":"rpi-gpio out","z":"4b32a8dc.cdbb48","name":"SW6","pin":"31","set":"","level":"0","freq":"","out":"out","x":830.9999542236328,"y":470.33349418640137,"wires":[]},{"id":"6a626c91.3f24a4","type":"rpi-gpio out","z":"4b32a8dc.cdbb48","name":"SW7","pin":"33","set":"","level":"0","freq":"","out":"out","x":830.9999542236328,"y":518.333498954773,"wires":[]},{"id":"3a7ed835.a45898","type":"rpi-gpio out","z":"4b32a8dc.cdbb48","name":"SW8","pin":"32","set":"","level":"0","freq":"","out":"out","x":830.9999542236328,"y":565.3335056304932,"wires":[]},{"id":"6686e128.e2fa9","type":"rpi-gpio out","z":"4b32a8dc.cdbb48","name":"SW9","pin":"15","set":"","level":"0","freq":"","out":"out","x":830.9999542236328,"y":613.3335094451904,"wires":[]},{"id":"57c7ad4d.767104","type":"rpi-gpio out","z":"4b32a8dc.cdbb48","name":"SW10","pin":"16","set":"","level":"0","freq":"","out":"out","x":831.9999542236328,"y":660.3336772918701,"wires":[]},{"id":"156bd0d6.bce0df","type":"switch","z":"4b32a8dc.cdbb48","name":"","property":"sw_no","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"},{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"},{"t":"eq","v":"7","vt":"str"},{"t":"eq","v":"8","vt":"str"},{"t":"eq","v":"9","vt":"str"},{"t":"eq","v":"10","vt":"str"}],"checkall":"true","outputs":10,"x":658.9999389648438,"y":449.0000114440918,"wires":[["fd67dc40.5870f"],["7e0d51ea.965c4"],["41206621.011758"],["34e7f813.0e5408"],["4a45d4c9.04f3bc"],["1a780c59.3f69f4"],["6a626c91.3f24a4"],["3a7ed835.a45898"],["6686e128.e2fa9"],["57c7ad4d.767104"]]},{"id":"48b7edc0.f8caa4","type":"delay","z":"4b32a8dc.cdbb48","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":394.0001411437988,"y":477.0001163482666,"wires":[["ebcfdf5c.08801"]]},{"id":"6e228a89.dd9394","type":"ibmiot in","z":"4b32a8dc.cdbb48","authentication":"apiKey","apiKey":"e270e8fd.954e58","inputType":"evt","deviceId":"RaspberryPi-001","applicationId":"","deviceType":"+","eventType":"+","commandType":"","format":"json","name":"IBM IoT","service":"registered","allDevices":"","allApplications":"","allDeviceTypes":true,"allEvents":true,"allCommands":"","allFormats":"","qos":0,"x":81.49991607666016,"y":426.80000042915344,"wires":[["e327ae80.51164","657ea6a5.78f4f8"]]},{"id":"e327ae80.51164","type":"debug","z":"4b32a8dc.cdbb48","name":"","active":true,"console":"false","complete":"false","x":175.4999828338623,"y":476.7999975681305,"wires":[]},{"id":"b94039dd.9529b8","type":"delay","z":"4b32a8dc.cdbb48","name":"Wait Timer","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":367.99989318847656,"y":425.999981880188,"wires":[["156bd0d6.bce0df","48b7edc0.f8caa4"]]},{"id":"e5a8c40.a1d354","type":"file in","z":"4b32a8dc.cdbb48","name":"Read WAV","filename":"/home/pi/temp/out.wav","format":"","sendError":true,"x":249.5223617553711,"y":91.77826118469238,"wires":[["e56679e5.01dce8"]]},{"id":"3fed906f.c4815","type":"http in","z":"4b32a8dc.cdbb48","name":"","url":"/test","method":"get","upload":false,"swaggerDoc":"","x":91.30009460449219,"y":91.66707611083984,"wires":[["e5a8c40.a1d354","66382713.615ed8"]]},{"id":"66382713.615ed8","type":"http response","z":"4b32a8dc.cdbb48","name":"http response","statusCode":"","headers":{},"x":256.0001564025879,"y":137.6829013824463,"wires":[]},{"id":"e56679e5.01dce8","type":"websocket out","z":"4b32a8dc.cdbb48","name":"websocket out","server":"","client":"4d5c8f59.5c08b","x":421.00009536743164,"y":92.00021171569824,"wires":[]},{"id":"682fd98d.049128","type":"websocket in","z":"4b32a8dc.cdbb48","name":"websocket in","server":"","client":"4d5c8f59.5c08b","x":627.3339157104492,"y":90.51876044273376,"wires":[["e56a1343.777ab","25468640.ba0cda"]]},{"id":"4c20ee90.e34ab","type":"comment","z":"4b32a8dc.cdbb48","name":"Receive Event & Control Raspberry Pi GPIO","info":"","x":199.99991607666016,"y":356.99994373321533,"wires":[]},{"id":"e06dc0.9da0a24","type":"comment","z":"4b32a8dc.cdbb48","name":"Send WAV","info":"","x":92.50006866455078,"y":45.20013427734375,"wires":[]},{"id":"4107636b.fd697c","type":"comment","z":"4b32a8dc.cdbb48","name":"Play WAV","info":"","x":617.5001068115234,"y":47.200077056884766,"wires":[]},{"id":"e270e8fd.954e58","type":"ibmiot","z":"","name":"","keepalive":"60","serverName":"","cleansession":true,"appId":"","shared":false},{"id":"4d5c8f59.5c08b","type":"websocket-client","z":"","path":"ws://iot-platform-starter-raspberry-pi.mybluemix.net/ws/sample","wholemsg":"false"}]