[{"id":"4ecd6c21.39aee4","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"16b4bcb7.538223","type":"debug","z":"4ecd6c21.39aee4","name":"Receive","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1440,"y":320,"wires":[]},{"id":"9c12e589.3a1f58","type":"inject","z":"4ecd6c21.39aee4","name":"","topic":"","payload":"79","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":70,"y":480,"wires":[["103e38ef.a48d37"]]},{"id":"8a029001.bf16","type":"inject","z":"4ecd6c21.39aee4","name":"","topic":"","payload":"85","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":70,"y":560,"wires":[["103e38ef.a48d37"]]},{"id":"95c31108.111c3","type":"inject","z":"4ecd6c21.39aee4","name":"","topic":"","payload":"81","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":70,"y":520,"wires":[["103e38ef.a48d37"]]},{"id":"f2a77fda.db3ab","type":"function","z":"4ecd6c21.39aee4","name":"send the number string with 1sec timeout","func":"input = msg.payload;\ninput = String(input); //just in case\nstorage = context.get(\"storage\"); // recall your storage\ntimer = context.get(\"timer\")||null; // recall last timer if exists\nclearTimeout(timer); // clear the last timer\ncontext.set(\"timer\",timer); // set it to be empty\nif (storage === undefined){\n storage = [];\n}\n\n//recall the lastout and make a number out of it\nlastOut = context.get(\"lastOut\").parseInt() || 1;\n\nif (input == \"PU\"){\n lastOut++;\n context.set(\"lastOut\",String(lastOut));\n return {payload: lastOut};\n}else if (input == \"PD\"){\n lastOut--;\n context.set(\"lastOut\",String(lastOut));\n return {payload: lastOut};\n}\n\n//________________________________________________________________this is only called when sending the code\nrun = function mytimer(){ //define a function that does all the stuff when you want to send the code\n\n output = storage.join() //put all array indices together in one string\n output = output.replace(/,/gi,\"\") // get rid of the commas e.g. replace them by an empty string\n//store the output to a contextvariable \"lastOut\"\ncontext.set(\"lastOut\",output)\n msg = {payload:output} \n node.send(msg)\n context.set(\"storage\",[]);\n return null;\n}\n\n//________________________________________________________________\n\n\ntimer = setTimeout(run,1000); // set your new timer (1sec is 1000 milliseconds)\nstorage.push(input); // append them to the end of your storage array\ncontext.set(\"storage\",storage); // set your new array back to storage\ncontext.set(\"timer\",timer); // store your new timer\nreturn null;","outputs":1,"noerr":0,"x":700,"y":380,"wires":[["bb056c77.72a3a","9dd13afe.f247c8"]]},{"id":"103e38ef.a48d37","type":"function","z":"4ecd6c21.39aee4","name":"replace keyboard input with numbers","func":"input = msg.payload;\ninput = String(input); //here are the variables whe need for the function to work\ntable = flow.get(\"corrtable\");\n//----------------------------------------------------------\n// here we do the stuff we actually want to do\n\nindexOfMyValue = table.keyboard.indexOf(input);\nnumberIWant = table.output[indexOfMyValue];\n\n//----------------------------------------------------------\n// now that you got the \"numberIWant\"\n\n//set the payload to it\nmsg.payload = numberIWant;\n\n// and send it out\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":380,"wires":[["f2a77fda.db3ab","7790398e.5fe8f8"]]},{"id":"9dd13afe.f247c8","type":"file in","z":"4ecd6c21.39aee4","name":"","filename":"/home/pi/Desktop/collecteweb.csv","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":1040,"y":380,"wires":[["c3b23a9c.f74a78"]]},{"id":"c3b23a9c.f74a78","type":"csv","z":"4ecd6c21.39aee4","name":"","sep":";","hdrin":false,"hdrout":"","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":false,"x":1270,"y":380,"wires":[["4321c23b.42b8ec","cf3d5a6e.63d2d8"]]},{"id":"4321c23b.42b8ec","type":"function","z":"4ecd6c21.39aee4","name":"your lookup func","func":"lookup = msg.lookup;\nvar output;\ndata = msg.payload;\n\nfor (i=0;i<data.length;i++){\n if (data[i].col1 == lookup){\n output = data[i].col2;\n context.set(\"lookup\",null);\n msg = {payload:output};\n node.send(msg);\n }\n}\n\nreturn null;","outputs":1,"noerr":0,"x":1440,"y":380,"wires":[["16b4bcb7.538223","def8e270.a643e"]]},{"id":"bb056c77.72a3a","type":"debug","z":"4ecd6c21.39aee4","name":"send","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"lookup","targetType":"msg","x":670,"y":320,"wires":[]},{"id":"cf3d5a6e.63d2d8","type":"debug","z":"4ecd6c21.39aee4","name":"object","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1250,"y":320,"wires":[]},{"id":"58d4b65a.80a018","type":"comment","z":"4ecd6c21.39aee4","name":"","info":"the seperator has to be semikolon (;)\nwhenn using miltiple columns, not commas\nthats an excel-thing","x":960,"y":420,"wires":[]},{"id":"def8e270.a643e","type":"exec","z":"4ecd6c21.39aee4","command":"DISPLAY=:0 chromium-browser","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":1390,"y":580,"wires":[[],[],[]]},{"id":"581279c2.f86a48","type":"rpi-keyboard","z":"4ecd6c21.39aee4","name":"","x":350,"y":120,"wires":[["45370388.767f9c"]]},{"id":"45370388.767f9c","type":"calculate","z":"4ecd6c21.39aee4","name":"","pauseType":"rate","calculation":"max","timeout":"500","timeoutUnits":"milliseconds","rate":"1","x":350,"y":180,"wires":[["103e38ef.a48d37"]]},{"id":"286877bd.f63a58","type":"inject","z":"4ecd6c21.39aee4","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"1","x":90,"y":40,"wires":[["58046171.80949"]]},{"id":"58046171.80949","type":"function","z":"4ecd6c21.39aee4","name":"set your correspondence table to flow","func":"corrtable = {}; //this is now an object, no array\n\n \ninput = [\"53\",\"71\",\"72\",\"73\",\"75\",\"76\",\"77\",\"79\",\"80\",\"81\",\"82\",\"104\",\"109\"]; //this\noutput = [\"!\",\"7\",\"8\",\"9\",\"4\",\"5\",\"6\",\"1\",\"2\",\"3\",\"0\",\"pu\",\"pd\"]; //and this are now arrays which we will put into the object\n\ncorrtable = \n{\"keyboard\":input,\"output\":output};\n\nflow.set(\"corrtable\",corrtable);\n\nreturn null;","outputs":0,"noerr":0,"x":350,"y":40,"wires":[]},{"id":"7790398e.5fe8f8","type":"debug","z":"4ecd6c21.39aee4","name":"replace","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":380,"y":320,"wires":[]},{"id":"5521cb26.f9e004","type":"inject","z":"4ecd6c21.39aee4","name":"","topic":"","payload":"!","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":70,"y":440,"wires":[["103e38ef.a48d37"]]}]