UNPKG

piball

Version:

Installer for foosball game score counting with NodeRED.

2 lines (1 loc) 25.4 kB
[{"type":"tab","id":"f8613267.079ed","label":"Goals"},{"type":"tab","id":"a1fba292.5e046","label":"Buttons"},{"type":"tab","id":"244c170f.dbb3e8","label":"Events"},{"type":"tab","id":"d744c298.28bb4","label":"Deploy"},{"type":"tab","id":"16199c35.e9e664","label":"Playground"},{"id":"fcb2c0e8.034d4","type":"twitter-credentials","screen_name":"@vergissberlin"},{"id":"246dc504.db923a","type":"MySQLdatabase","host":"127.0.0.1","port":"3306","db":"piball"},{"id":"a447a391.5bb86","type":"function","name":"totalOne","func":"msg.totalOne = msg.payload + 1;\ncontext.global.undo = { 'totalOne': msg.payload };\n\nreturn msg;","outputs":"1","x":995.5,"y":180,"z":"f8613267.079ed","wires":[["1e98a742.e16759"]]},{"id":"a1cc9c15.5e336","type":"inject","name":"Goal","topic":"","payload":"teamOne","payloadType":"string","repeat":"","crontab":"","once":false,"x":110,"y":120,"z":"f8613267.079ed","wires":[["5d535e9d.a2aca"]]},{"id":"296332c7.d69cce","type":"debug","name":"","active":false,"console":"false","complete":"true","x":1330,"y":140,"z":"f8613267.079ed","wires":[]},{"id":"50a01bab.af5fe4","type":"function","name":"totalTwo","func":"msg.totalTwo = msg.payload + 1;\ncontext.global.undo = { 'totalTwo': msg.payload };\n\n\nreturn msg;","outputs":"1","x":995.5,"y":300,"z":"f8613267.079ed","wires":[["1e98a742.e16759"]]},{"id":"f82aa5c8.07d558","type":"inject","name":"Goal","topic":"teamTwo","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":110,"y":360,"z":"f8613267.079ed","wires":[["77e34121.881cc"]]},{"id":"62822d.ff9d7dd4","type":"firebase modify","name":"","firebaseurl":"https://vivid-fire-2266.firebaseio.com/total","child":"","method":"update","x":1358.5,"y":240,"z":"f8613267.079ed","wires":[]},{"id":"1e98a742.e16759","type":"function","name":"Merge total","func":"if(msg.totalOne) {\n msg.payload = {\"totalOne\": msg.totalOne}\n}\nif(msg.totalTwo) {\n msg.payload = {\"totalTwo\": msg.totalTwo}\n}\n\nreturn msg;\n","outputs":"1","x":1184.5,"y":240,"z":"f8613267.079ed","wires":[["296332c7.d69cce","62822d.ff9d7dd4"]]},{"id":"1f947594.e06b8a","type":"firebase query","name":"totalOne","firebaseurl":"https://vivid-fire-2266.firebaseio.com/total/totalOne","child":"","x":835.5,"y":180,"z":"f8613267.079ed","wires":[["a447a391.5bb86","65cd7eff.9a328"]]},{"id":"1d8edcfa.e27123","type":"firebase query","name":"totalTwo","firebaseurl":"https://vivid-fire-2266.firebaseio.com/total/totalTwo","child":"","x":835.5,"y":300,"z":"f8613267.079ed","wires":[["50a01bab.af5fe4","65cd7eff.9a328"]]},{"id":"65cd7eff.9a328","type":"debug","name":"","active":false,"console":"false","complete":"false","x":989,"y":240,"z":"f8613267.079ed","wires":[]},{"id":"bb05ed54.44fa1","type":"comment","name":"Goals","info":"todo:\n- additional data in database\n\t- weather\n\t- wind\n\t- sun\n- Events\n\t- hit count/1000\n\t- Mounsterkill","x":110,"y":60,"z":"f8613267.079ed","wires":[]},{"id":"26152a67.d9ead6","type":"mysql","mydb":"246dc504.db923a","name":"MySQL","x":832,"y":240,"z":"f8613267.079ed","wires":[["65cd7eff.9a328"]]},{"id":"6f5f84ec.90a07c","type":"function","name":"mysql one","func":"// insert score\nmsg.topic = 'INSERT INTO `piball`.`score` (`type`, `created_at`) VALUES (\"teamOne\", NOW());';\nreturn msg;\n","outputs":1,"x":681,"y":220,"z":"f8613267.079ed","wires":[["26152a67.d9ead6"]]},{"id":"a5d24abd.5a2db8","type":"function","name":"mysql two","func":"// insert score\nmsg.topic = 'INSERT INTO `piball`.`score` (`type`, `created_at`) VALUES (\"teamTwo\", NOW());';\nreturn msg;\n","outputs":1,"x":680,"y":260,"z":"f8613267.079ed","wires":[["26152a67.d9ead6"]]},{"id":"663e0ae4.99c1f4","type":"inject","name":"undo","topic":"","payload":"1","payloadType":"string","repeat":"","crontab":"","once":false,"x":202.42857360839844,"y":223.4285707473755,"z":"a1fba292.5e046","wires":[[]]},{"id":"f582e48e.0a7d18","type":"function","name":"undo function","func":"if(typeof context.global.undo === 'object') {\n\tmsg.payload = context.global.undo;\n\tdelete context.global.undo;\n\treturn msg;\n}\n","outputs":1,"x":397.42857360839844,"y":157.4285707473755,"z":"a1fba292.5e046","wires":[["30c3a462.cf3c5c","428f2e72.bd70d"]]},{"id":"30c3a462.cf3c5c","type":"debug","name":"","active":false,"console":"false","complete":"false","x":623,"y":100,"z":"a1fba292.5e046","wires":[]},{"id":"d3570d1f.2ca8f","type":"comment","name":"Undo","info":"- Undo counting last score on game and total scores once\n- Play sound \"zonk\"","x":150,"y":120,"z":"a1fba292.5e046","wires":[]},{"id":"428f2e72.bd70d","type":"firebase modify","name":"","firebaseurl":"https://vivid-fire-2266.firebaseio.com/team","child":"","method":"update","x":632.4285736083984,"y":157.4285707473755,"z":"a1fba292.5e046","wires":[]},{"id":"1c1c3429.e3e3cc","type":"function","name":"undo mysql","func":"// delete last inserted id\nmsg.topic = 'DELETE FROM piball.score WHERE score.id=LAST_INSERT_ID();';\n\nreturn msg;","outputs":1,"x":393.42857360839844,"y":223.4285707473755,"z":"a1fba292.5e046","wires":[["62210610.9ddef8"]]},{"id":"7d2b8f04.82d47","type":"debug","name":"","active":false,"console":"false","complete":"false","x":771.4285736083984,"y":223.4285707473755,"z":"a1fba292.5e046","wires":[]},{"id":"62210610.9ddef8","type":"mysql","mydb":"246dc504.db923a","name":"MySQL","x":608.4285736083984,"y":223.4285707473755,"z":"a1fba292.5e046","wires":[["7d2b8f04.82d47"]]},{"id":"7867cd3d.879834","type":"comment","name":"New game","info":"- Reset team scores\n- Start game event listener","x":153.42855834960938,"y":320.4285831451416,"z":"a1fba292.5e046","wires":[]},{"id":"4b638170.b49c8","type":"comment","name":"Ring the bell","info":"- Rings a bell (sound)\n- Send a chat message (XMPP)\n- Send a notification on chrome browsers\n- Do not count score until \"new game\" button is pressed","x":158.42857142857142,"y":599.9999999999999,"z":"a1fba292.5e046","wires":[]},{"id":"27158ab6.d8ea76","type":"firebase query","name":"teamOne","firebaseurl":"https://vivid-fire-2266.firebaseio.com/team/teamOne","child":"","x":838,"y":120,"z":"f8613267.079ed","wires":[["de07f793.21f808"]]},{"id":"de07f793.21f808","type":"function","name":"teamOne","func":"// Undo\ncontext.global.undo = {\n\ttype: 'lastScore',\n\tteamOne: msg.payload\n\t};\n\n// Game started?\nif(typeof context.global.game === 'undefined') {\n return [null,null];\n} \n\n// Score\nif(msg.payload < 5 && context.global.game.running) {\n\tmsg.teamOne = msg.payload + 1;\n\treturn [ null, msg ];\n} else {\n\tcontext.global.game = {running: false};\n\treturn [ msg, null];\n}\n","outputs":"2","x":1004.4999923706055,"y":119.74999809265137,"z":"f8613267.079ed","wires":[[],["19cf4336.e630bd"]]},{"id":"19cf4336.e630bd","type":"function","name":"Merge team","func":"if(msg.teamOne) {\n msg.payload = {\"teamOne\": msg.teamOne}\n}\nif(msg.teamTwo) {\n msg.payload = {\"teamTwo\": msg.teamTwo}\n}\n\nreturn msg;\n","outputs":1,"x":1627,"y":240,"z":"f8613267.079ed","wires":[["6e577cce.91a884","f7293668.08d6c8"]]},{"id":"6e577cce.91a884","type":"firebase modify","name":"","firebaseurl":"https://vivid-fire-2266.firebaseio.com/team","child":"","method":"update","x":1818.5,"y":240,"z":"f8613267.079ed","wires":[]},{"id":"f7293668.08d6c8","type":"debug","name":"","active":true,"console":"false","complete":"false","x":1809,"y":140,"z":"f8613267.079ed","wires":[]},{"id":"19b603d8.e649fc","type":"comment","name":"Event notifications","info":"- Under table (10:0 || 0:10)\n- Break thru (totalOne || totalTwo) % 1000","x":177.14285714285714,"y":107.14285714285714,"z":"244c170f.dbb3e8","wires":[]},{"id":"4215209a.bdeae","type":"firebase query","name":"teamTwo","firebaseurl":"https://vivid-fire-2266.firebaseio.com/team/teamTwo","child":"","x":838,"y":360,"z":"f8613267.079ed","wires":[["6aa7c969.955838"]]},{"id":"e4200155.1be","type":"firebase watch","name":"team","firebaseurl":"https://vivid-fire-2266.firebaseio.com/team","x":150,"y":300,"z":"244c170f.dbb3e8","wires":[["628c6e41.9d739","2d7143c1.d28ebc"]]},{"id":"628c6e41.9d739","type":"debug","name":"","active":false,"console":"false","complete":"false","x":368,"y":340,"z":"244c170f.dbb3e8","wires":[]},{"id":"6aa7c969.955838","type":"function","name":"teamTwo","func":"// Undo\ncontext.global.undo = {\n\ttype: 'lastScore',\n\tteamTwo: msg.payload\n\t};\n\n// Game started?\nif(typeof context.global.game === 'undefined') {\n return [null,null];\n}\n\n// Score\nif(msg.payload < 5 && context.global.game.running) {\n\tmsg.teamTwo = msg.payload + 1;\n\treturn [ msg, null ];\n} else {\n\tcontext.global.game = {running: false};\n\treturn [ null, msg ];\n}\n","outputs":"2","x":998,"y":360,"z":"f8613267.079ed","wires":[["19cf4336.e630bd"],[]]},{"id":"3c5651ec.c3a9ae","type":"comment","name":"Team","info":"","x":145,"y":229.99999904632568,"z":"244c170f.dbb3e8","wires":[]},{"id":"2d7143c1.d28ebc","type":"function","name":"EventTeam","func":"var \n teamOne = parseInt(msg.payload.teamOne),\n teamTwo = parseInt(msg.payload.teamTwo);\n\n// Near under table\nif((teamOne === 4 || teamTwo === 4) && \n(teamOne === 0 || teamTwo === 0)){\n\tmsg.payload.event = 'nearUnderTable';\n}\n\n// Under table\nif((teamOne === 5 || teamTwo === 5) && \n(teamOne === 0 || teamTwo === 0)){\n\tmsg.payload.event = 'underTable';\n}\n\n// Game over\n\n// Under table\nvar over = null;\nif(teamOne === 5 || teamTwo === 5){\n\tover = msg;\n}\n\nreturn [msg,over];\n\n// Quick goal\n/*\n- Save time game started\n- Save time last goal\n- if(((lastGoalTime || goalStartTime) - goalNowTime) < 20 sec)\n*/\n\n// Catching up\n/*\n- if(Math.abs(teamOne - teamTwo) > 5): start watching\n- Every Goal: if((Math.abs(teamOne - teamTwo) === 0): msg.catchingUp\n*/\n\n","outputs":"2","x":364,"y":300,"z":"244c170f.dbb3e8","wires":[["ce63c1db.319c4"],["73cadd8.f8c3524","6c0fae0e.93f05","120b4f6.fedf4b1"]]},{"id":"ce63c1db.319c4","type":"switch","name":"EventSwitch","property":"payload.event","rules":[{"t":"eq","v":"nearUnderTable"},{"t":"eq","v":"underTable"},{"t":"eq","v":"catchUp"}],"checkall":"false","outputs":3,"x":627,"y":280,"z":"244c170f.dbb3e8","wires":[["a1f9a2dd.5e066"],["a1f9a2dd.5e066","48e68954.b71978"],["a1f9a2dd.5e066"]]},{"id":"a1f9a2dd.5e066","type":"debug","name":"","active":true,"console":"false","complete":"false","x":868,"y":220,"z":"244c170f.dbb3e8","wires":[]},{"id":"a0dd9714.5f2268","type":"comment","name":"Total","info":"","x":150,"y":440,"z":"244c170f.dbb3e8","wires":[]},{"id":"6be69313.94196c","type":"firebase watch","name":"totalOne","firebaseurl":"https://vivid-fire-2266.firebaseio.com/total/totalOne","x":152,"y":500,"z":"244c170f.dbb3e8","wires":[["d9005804.26ffa8","5715ac9b.a8ea54"]]},{"id":"d9005804.26ffa8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":368,"y":540,"z":"244c170f.dbb3e8","wires":[]},{"id":"5715ac9b.a8ea54","type":"function","name":"EventTotal","func":"// Break thru 1000\nif(parseInt(msg.payload) % 1000 === 0){\n msg.payload = {\n team: 'one',\n score: msg.payload,\n event: 'break1000'\n };\n} else \n\n// Break thru 1000\nif(parseInt(msg.payload) % 100 === 0){\n msg.payload.event = 'break100';\n} else {\n msg.payload.event = false;\n}\n\nreturn msg;\n","outputs":1,"x":362.5,"y":500,"z":"244c170f.dbb3e8","wires":[["e762d39.f189d3","fbfdf424.040208"]]},{"id":"e762d39.f189d3","type":"switch","name":"EventSwitch","property":"payload.event","rules":[{"t":"eq","v":"teamOneBreak1000"},{"t":"eq","v":"teamTwoBreak1000"}],"checkall":"false","outputs":2,"x":627,"y":580,"z":"244c170f.dbb3e8","wires":[["d31bbb3e.2ce448"],[]]},{"id":"fbfdf424.040208","type":"debug","name":"","active":false,"console":"false","complete":"false","x":628,"y":500,"z":"244c170f.dbb3e8","wires":[]},{"id":"d31bbb3e.2ce448","type":"template","name":"Break1000","field":"payload","template":"Hey ho!\n\nDie tausender Marke wurde durchbrochen!\nThis is the payload: {{payload}}!\n\n\n--- \nNRsoccer","x":876.6666412353516,"y":505.00002002716064,"z":"244c170f.dbb3e8","wires":[[]]},{"id":"c07d3626.3f82c8","type":"firebase watch","name":"totalTwo","firebaseurl":"https://vivid-fire-2266.firebaseio.com/total/totalTwo","x":152,"y":640,"z":"244c170f.dbb3e8","wires":[["d539ff36.2ac6","dfad772b.205288"]]},{"id":"d539ff36.2ac6","type":"debug","name":"","active":false,"console":"false","complete":"false","x":368,"y":680,"z":"244c170f.dbb3e8","wires":[]},{"id":"2fa1d6b6.d05e2a","type":"comment","name":"Events","info":"","x":1211,"y":192,"z":"244c170f.dbb3e8","wires":[]},{"id":"dfad772b.205288","type":"function","name":"EventTotal","func":"// Break thru 1000\nif(parseInt(msg.payload) % 1000 === 0){\n msg.payload.event = 'break1000';\n} else \n\n// Break thru 1000\nif(parseInt(msg.payload) % 100 === 0){\n msg.payload.event = 'break100';\n} else {\n msg.payload.event = false;\n}\n\nreturn msg;\n","outputs":1,"x":362.5,"y":640,"z":"244c170f.dbb3e8","wires":[["e762d39.f189d3"]]},{"id":"c8d489c1.372b78","type":"template","name":"Break100","field":"payload","template":"This is the payload: {{payload}}!","x":873.3333282470703,"y":571.6666488647461,"z":"244c170f.dbb3e8","wires":[[]]},{"id":"3fd046e1.c02fba","type":"inject","name":"new game","topic":"","payload":"1","payloadType":"string","repeat":"","crontab":"","once":false,"x":198,"y":420,"z":"a1fba292.5e046","wires":[["4fb17b32.b04e84","caa0a40.f355f6"]]},{"id":"9704bd95.68fb4","type":"firebase query","name":"Team (get)","firebaseurl":"https://vivid-fire-2266.firebaseio.com/team","child":"","x":604,"y":360,"z":"a1fba292.5e046","wires":[["ea9896f2.156768"]]},{"id":"2f2fc33b.d0d03c","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":201,"y":704,"z":"a1fba292.5e046","wires":[[]]},{"id":"410679e.fbef988","type":"function","name":"Multiple","func":"var newMsg = { payload: 'Ring Ring' };\nreturn [msg, newMsg];","outputs":"2","x":373,"y":649,"z":"a1fba292.5e046","wires":[["738cdef.f8c732"],[]]},{"id":"738cdef.f8c732","type":"debug","name":"","active":false,"console":"false","complete":"false","x":580,"y":650,"z":"a1fba292.5e046","wires":[]},{"id":"ea9896f2.156768","type":"function","name":"reset","func":"msg.payload = {\n\t'teamOne': 0, \n\t'teamTwo': 0\n}\n\ncontext.global.game = {running: true};\n\ncontext.global.undo = { \n\t'teamOne': msg.payload.teamOne,\n\t'teamTwo': msg.payload.teamTwo\n};\n\nconsole.log(context.global);\n\nreturn msg;\n","outputs":1,"x":770,"y":360,"z":"a1fba292.5e046","wires":[["4a7b1717.b584e8","f5697d85.0a968"]]},{"id":"4a7b1717.b584e8","type":"firebase modify","name":"Team (reset)","firebaseurl":"https://vivid-fire-2266.firebaseio.com/team","child":"","method":"update","x":942,"y":360,"z":"a1fba292.5e046","wires":[]},{"id":"73cadd8.f8c3524","type":"function","name":"Turn off","func":"msg.payload = 0;\nreturn msg;","outputs":"1","x":612.5,"y":340,"z":"244c170f.dbb3e8","wires":[["af972582.5068d8","f1894519.0e76b8","fce7e97b.031818"]]},{"id":"9af804bd.6507f8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":608,"y":300,"z":"a1fba292.5e046","wires":[]},{"id":"4fb17b32.b04e84","type":"switch","name":"","property":"payload","rules":[{"t":"eq","v":1,"v2":0}],"checkall":"true","outputs":1,"x":390,"y":360,"z":"a1fba292.5e046","wires":[["9704bd95.68fb4","9af804bd.6507f8","83f3fa09.7c0c08","42bacba0.bd4534"]]},{"id":"97fa6aaa.680598","type":"inject","name":"GIT commit","topic":"Deploy","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":177.5,"y":140,"z":"d744c298.28bb4","wires":[["32bff542.cd400a"]]},{"id":"27bfcd7f.d84032","type":"debug","name":"","active":false,"console":"false","complete":"false","x":729,"y":140,"z":"d744c298.28bb4","wires":[]},{"id":"32bff542.cd400a","type":"exec","command":"sudo -u pi sh ../piball/lib/deploy.sh","append":"","useSpawn":false,"name":"deploy.sh","x":450,"y":140,"z":"d744c298.28bb4","wires":[[],["27bfcd7f.d84032"],[]]},{"id":"caa0a40.f355f6","type":"debug","name":"","active":false,"console":"false","complete":"false","x":408,"y":420,"z":"a1fba292.5e046","wires":[]},{"id":"6fe851d9.9017b","type":"switch","name":"","property":"payload","rules":[{"t":"eq","v":1,"v2":0}],"checkall":"true","outputs":1,"x":236,"y":200,"z":"f8613267.079ed","wires":[["d189204d.2e76e"]]},{"id":"d189204d.2e76e","type":"delay","name":"limit","pauseType":"rate","timeout":"1","timeoutUnits":"seconds","rate":"12","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":356,"y":200,"z":"f8613267.079ed","wires":[["5d535e9d.a2aca"]]},{"id":"4171778c.be8e88","type":"switch","name":"","property":"payload","rules":[{"t":"eq","v":1,"v2":0}],"checkall":"true","outputs":1,"x":236,"y":280,"z":"f8613267.079ed","wires":[["66475542.99b8ac"]]},{"id":"66475542.99b8ac","type":"delay","name":"limit","pauseType":"rate","timeout":"1","timeoutUnits":"seconds","rate":"12","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":356,"y":280,"z":"f8613267.079ed","wires":[["77e34121.881cc"]]},{"id":"84265b82.7bd9a8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":269,"y":240,"z":"f8613267.079ed","wires":[]},{"id":"a27333ce.5d8cd","type":"inject","name":"","topic":"GIT pull","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":178,"y":218,"z":"d744c298.28bb4","wires":[["b764a78b.489b58"]]},{"id":"b764a78b.489b58","type":"exec","command":"sudo -u pi sh ../piball/lib/pull.sh","append":"","useSpawn":"","name":"pull.sh","x":450,"y":220,"z":"d744c298.28bb4","wires":[[],["27bfcd7f.d84032"],[]]},{"id":"5d535e9d.a2aca","type":"function","name":"Goals status","func":"if(typeof context.global != 'undefined') {\n\tif(typeof context.global.game != 'undefined') {\n\t\tif(typeof context.global.game.running != 'undefined') {\n\t\t\tif(context.global.game.running) {\n\t\t\t\treturn msg;\n\t\t\t}\n\t\t}\n\t}\n}\nreturn null;\n","outputs":1,"x":508,"y":200,"z":"f8613267.079ed","wires":[["6f5f84ec.90a07c","27158ab6.d8ea76","1f947594.e06b8a","b868913c.47977","f337279.f0cc8d8","9a900ae9.656ff8"]]},{"id":"77e34121.881cc","type":"function","name":"Goals status","func":"if(typeof context.global != 'undefined') {\n\tif(typeof context.global.game != 'undefined') {\n\t\tif(typeof context.global.game.running != 'undefined') {\n\t\t\tif(context.global.game.running) {\n\t\t\t\treturn msg;\n\t\t\t}\n\t\t}\n\t}\n}\nreturn null;\n","outputs":1,"x":508,"y":280,"z":"f8613267.079ed","wires":[["a5d24abd.5a2db8","1d8edcfa.e27123","4215209a.bdeae","b868913c.47977","f673a2f8.098c6","872fdea0.78d02"]]},{"id":"221b3da2.dde4c2","type":"inject","name":"","topic":"Restart","payload":"restart","payloadType":"none","repeat":"","crontab":"","once":false,"x":190,"y":380,"z":"d744c298.28bb4","wires":[["76436e5f.89bc9"]]},{"id":"76436e5f.89bc9","type":"exec","command":"pm2 restart node-red","append":"","useSpawn":"","name":"NodeRED restart","x":482.5,"y":380,"z":"d744c298.28bb4","wires":[[],["6de5d7bb.921a28"],[]]},{"id":"6de5d7bb.921a28","type":"debug","name":"","active":false,"console":"false","complete":"false","x":808,"y":380,"z":"d744c298.28bb4","wires":[]},{"id":"ffa23f2e.005dc","type":"comment","name":"NodeRED","info":"","x":127.5,"y":321,"z":"d744c298.28bb4","wires":[]},{"id":"de624dd8.219db","type":"comment","name":"GIT","info":"","x":110,"y":80,"z":"d744c298.28bb4","wires":[]},{"id":"b868913c.47977","type":"debug","name":"","active":false,"console":"false","complete":"false","x":509,"y":240,"z":"f8613267.079ed","wires":[]},{"id":"f5697d85.0a968","type":"debug","name":"","active":false,"console":"false","complete":"false","x":941,"y":300,"z":"a1fba292.5e046","wires":[]},{"id":"28b3372b.d74cc8","type":"rpi-pibrella in","name":"","pin":"In A","read":false,"x":110,"y":200,"z":"f8613267.079ed","wires":[["6fe851d9.9017b","84265b82.7bd9a8"]]},{"id":"6f9ddd3e.906224","type":"rpi-pibrella in","name":"","pin":"In D","read":false,"x":110,"y":280,"z":"f8613267.079ed","wires":[["4171778c.be8e88","84265b82.7bd9a8"]]},{"id":"5861606b.a79ea","type":"rpi-pibrella in","name":"","pin":"Red Button","read":false,"x":200,"y":360,"z":"a1fba292.5e046","wires":[["4fb17b32.b04e84","caa0a40.f355f6"]]},{"id":"83f3fa09.7c0c08","type":"rpi-pibrella out","name":"","pin":"Green LED","set":true,"level":"0","x":603.5,"y":420,"z":"a1fba292.5e046","wires":[]},{"id":"1839c93f.e7c637","type":"rpi-pibrella out","name":"","pin":"Out E","set":false,"level":"0","x":830,"y":60,"z":"f8613267.079ed","wires":[]},{"id":"f337279.f0cc8d8","type":"delay","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":536.5,"y":60,"z":"f8613267.079ed","wires":[["80947527.7f6b88"]]},{"id":"80947527.7f6b88","type":"function","name":"off","func":"msg.payload = 0;\nreturn msg;","outputs":1,"x":670,"y":60,"z":"f8613267.079ed","wires":[["1839c93f.e7c637"]]},{"id":"bbc63d92.4439c","type":"rpi-pibrella out","name":"","pin":"Out F","set":false,"level":"0","x":830,"y":420,"z":"f8613267.079ed","wires":[]},{"id":"f673a2f8.098c6","type":"delay","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":536.5,"y":420,"z":"f8613267.079ed","wires":[["8b127a73.74ed88"]]},{"id":"8b127a73.74ed88","type":"function","name":"off","func":"msg.payload = 0;\nreturn msg;","outputs":1,"x":670,"y":420,"z":"f8613267.079ed","wires":[["bbc63d92.4439c"]]},{"id":"7e7eb564.81814c","type":"rpi-pibrella out","name":"","pin":"Buzzer ","set":false,"level":"0","x":770,"y":440,"z":"244c170f.dbb3e8","wires":[]},{"id":"fce7e97b.031818","type":"delay","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":616.5,"y":420,"z":"244c170f.dbb3e8","wires":[["7e7eb564.81814c","f80e59c5.07f1a8","b6a08a1a.495f78","d7f27350.280d9","f1894519.0e76b8"]]},{"id":"f80e59c5.07f1a8","type":"rpi-pibrella out","name":"","pin":"Red LED","set":true,"level":"0","x":777,"y":400,"z":"244c170f.dbb3e8","wires":[]},{"id":"af972582.5068d8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":788,"y":340,"z":"244c170f.dbb3e8","wires":[]},{"id":"120b4f6.fedf4b1","type":"function","name":"sound","func":"msg.payload= 320;\nreturn msg;","outputs":1,"x":610,"y":460,"z":"244c170f.dbb3e8","wires":[["7e7eb564.81814c"]]},{"id":"6c0fae0e.93f05","type":"function","name":"Turn on","func":"msg.payload = 1;\nreturn msg;","outputs":1,"x":610,"y":380,"z":"244c170f.dbb3e8","wires":[["f80e59c5.07f1a8","b6a08a1a.495f78","d7f27350.280d9"]]},{"id":"f1894519.0e76b8","type":"rpi-pibrella out","name":"","pin":"Green LED","set":true,"level":"0","x":1263.5,"y":380,"z":"244c170f.dbb3e8","wires":[]},{"id":"b6a08a1a.495f78","type":"rpi-pibrella out","name":"","pin":"Out E","set":false,"level":"0","x":910,"y":400,"z":"244c170f.dbb3e8","wires":[]},{"id":"d7f27350.280d9","type":"rpi-pibrella out","name":"","pin":"Out F","set":false,"level":"0","x":912,"y":440,"z":"244c170f.dbb3e8","wires":[]},{"id":"9a900ae9.656ff8","type":"function","name":"on","func":"msg.payload = 1;\nreturn msg;","outputs":1,"x":670,"y":100,"z":"f8613267.079ed","wires":[["1839c93f.e7c637"]]},{"id":"872fdea0.78d02","type":"function","name":"on","func":"msg.payload = 1;\nreturn msg;","outputs":1,"x":670,"y":380,"z":"f8613267.079ed","wires":[["bbc63d92.4439c"]]},{"id":"48e68954.b71978","type":"delay","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":916.5,"y":280,"z":"244c170f.dbb3e8","wires":[["66e492b5.991b6c","6f758528.908a7c","32084b1c.cdf7b4"]]},{"id":"c580f2b8.3a7f1","type":"rpi-pibrella out","name":"","pin":"Buzzer ","set":false,"level":"0","x":1250.5,"y":280,"z":"244c170f.dbb3e8","wires":[]},{"id":"66e492b5.991b6c","type":"function","name":"sound","func":"msg.payload= 50;\nreturn msg;","outputs":1,"x":1070,"y":280,"z":"244c170f.dbb3e8","wires":[["c580f2b8.3a7f1"]]},{"id":"6f758528.908a7c","type":"delay","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1076.5,"y":320,"z":"244c170f.dbb3e8","wires":[["cb05702a.34fa9"]]},{"id":"cb05702a.34fa9","type":"function","name":"off","func":"msg.payload = 0;\nreturn msg;","outputs":1,"x":1250,"y":320,"z":"244c170f.dbb3e8","wires":[["c580f2b8.3a7f1"]]},{"id":"4dd06c63.b22f94","type":"rpi-pibrella out","name":"","pin":"Amber LED","set":true,"level":"0","x":1264.5,"y":240,"z":"244c170f.dbb3e8","wires":[]},{"id":"32084b1c.cdf7b4","type":"function","name":"Turn on","func":"msg.payload = 1;\nreturn msg;","outputs":1,"x":1072.5,"y":240,"z":"244c170f.dbb3e8","wires":[["4dd06c63.b22f94"]]},{"id":"42bacba0.bd4534","type":"function","name":"Turn off","func":"msg.payload = 0;\nreturn msg;","outputs":"1","x":592.5,"y":460,"z":"a1fba292.5e046","wires":[["ec6daefe.13925","e2e7190b.1d18e8"]]},{"id":"ec6daefe.13925","type":"rpi-pibrella out","name":"","pin":"Amber LED","set":true,"level":"0","x":764.5,"y":460,"z":"a1fba292.5e046","wires":[]},{"id":"e2e7190b.1d18e8","type":"rpi-pibrella out","name":"","pin":"Red LED","set":false,"level":"0","x":757,"y":500,"z":"a1fba292.5e046","wires":[]}]