SHARE
TWEET

nodered_trap

a guest Feb 18th, 2019 25 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [{"id":"992f387a.5cea28","type":"tab","label":"Trap","disabled":false,"info":""},{"id":"b0f52848.74da88","type":"mqtt in","z":"992f387a.5cea28","name":"","topic":"node/climate2/barometer/#","qos":"2","broker":"787db76e.6345b8","x":250,"y":700,"wires":[["2c7c0fe0.edd5"]]},{"id":"e44369a6.31bd88","type":"function","z":"992f387a.5cea28","name":"trap","func":"var calendarH=flow.get('calendarH')||\"∅\";\n\n\nif(msg.allow==\"yes\"){\n    \n    temp=flow.get('temp')||\"∅\"\n    tempO=flow.get('tempO')||\"∅\"\n    barPress=flow.get('barPress')||\"∅\"\n    relHum=flow.get('relHum')||\"∅\"\n    lux=flow.get('lux')||\"∅\"\n    videoName=flow.get('videoName')||\"∅\";\n    \n     msg.date=Date.now();\n     \n   //Přidání končí msg.payload=\"Teplota je \"+temp+\" Bar tlak je \"+barPress+\" Vlhkost je \"+relHum+\" Světlo je \"+lux+\" Datum Přidání začíná\"+msg.payload;\n   delete msg.payload;\n    \n    //\n    delete msg.allow;\n    msg.thermometer=temp;\n    msg.thermometerOutside=tempO;\n    msg.barometer=barPress;\n    msg.hygrometer=relHum;\n    msg.luxmeter=lux\n    msg.videoName=videoName.trim()+\".mp4\"\n   \n   \n \n   \nreturn msg;    \n}\n\n","outputs":1,"noerr":0,"x":970,"y":280,"wires":[["cf140caf.14cf1"]]},{"id":"d996fa4e.7e1ff8","type":"mqtt in","z":"992f387a.5cea28","name":"","topic":"node/climate2/thermometer/#","qos":"2","broker":"787db76e.6345b8","x":240,"y":660,"wires":[["26043844.f6a858"]]},{"id":"4ed8c2b3.3ff52c","type":"mqtt in","z":"992f387a.5cea28","name":"","topic":"node/climate2/lux-meter/#","qos":"2","broker":"787db76e.6345b8","x":250,"y":740,"wires":[["efba8409.24a7f8"]]},{"id":"cf140caf.14cf1","type":"mongodb out","z":"992f387a.5cea28","mongodb":"eb2315be.2a8ad8","name":"mongo_Coll_Insert","collection":"coll","payonly":false,"upsert":false,"multi":false,"operation":"insert","x":1070,"y":660,"wires":[]},{"id":"26043844.f6a858","type":"function","z":"992f387a.5cea28","name":"saveThermometer","func":"var temp=flow.get('temp')||\"∅\";\n\nif(msg.topic===\"node/climate2/thermometer/0:0/temperature\"||msg.topic===\"node/climate2/thermometer/0:1/temperature\"){\n   temp=msg.payload;\n   flow.set('temp',temp);\n}\n","outputs":1,"noerr":0,"x":550,"y":580,"wires":[["e44369a6.31bd88"]]},{"id":"2c7c0fe0.edd5","type":"function","z":"992f387a.5cea28","name":"saveBarometer","func":"var barPress=flow.get('barPress')||\"∅\";\n\nif(msg.topic===\"node/climate2/barometer/0:0/pressure\"){\n   barPress=msg.payload;\n   flow.set('barPress',barPress);\n}\n","outputs":1,"noerr":0,"x":560,"y":640,"wires":[["e44369a6.31bd88"]]},{"id":"efba8409.24a7f8","type":"function","z":"992f387a.5cea28","name":"saveLux-meter","func":"var lux=flow.get('lux')||\"∅\";\n\nif(msg.topic===\"node/climate2/lux-meter/0:0/illuminance\"){\n\n   lux=msg.payload;\n   flow.set('lux',lux);\n    \n}","outputs":1,"noerr":0,"x":560,"y":680,"wires":[["e44369a6.31bd88"]]},{"id":"a41bfc41.14a4b","type":"mqtt in","z":"992f387a.5cea28","name":"","topic":"node/climate2/hygrometer/#","qos":"2","broker":"787db76e.6345b8","x":260,"y":780,"wires":[["1151a932.61f157"]]},{"id":"1151a932.61f157","type":"function","z":"992f387a.5cea28","name":"saveHygrometer","func":"var relHum=flow.get('relHum')||\"∅\";\n\nif(msg.topic===\"node/climate2/hygrometer/0:4/relative-humidity\"){\n   relHum=msg.payload;\n   flow.set('relHum',relHum);\n    \n}","outputs":1,"noerr":0,"x":560,"y":720,"wires":[["e44369a6.31bd88"]]},{"id":"4bdc49bc.9b9158","type":"function","z":"992f387a.5cea28","name":"saveCalendar","func":"var calendarH=flow.get('calendarH')||\"∅\";\n\nif(msg.topic===\"calendar\"){\n    calendarH=msg.payload;\n     flow.set('calendarH',calendarH);\n\n\n    \n}\n","outputs":1,"noerr":0,"x":460,"y":60,"wires":[["a8481115.81abb"]]},{"id":"669c5ca1.4cf154","type":"exec","z":"992f387a.5cea28","command":"/home/camera/scripts/camera_trap.sh","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"camera.sh","x":510,"y":140,"wires":[[],["60f6dd68.794834"],["b8530de1.72a01"]]},{"id":"a8481115.81abb","type":"function","z":"992f387a.5cea28","name":"execVerify","func":"var calendarH=flow.get('calendarH')||\"∅\";\n\nif(msg.topic===\"node/pir/buffer/-/data\"&&calendarH==\"on\"){\n  //  msg.payload=\"\";\nPřidání končí  return Přidání začínámsg;\n    \n\n}\n","outputs":1,"noerr":0,"x":350,"y":160,"wires":[["669c5ca1.4cf154"]]},{"id":"66bee43f.2eb54c","type":"trigger","z":"992f387a.5cea28","op1":"1","op2":"","op1type":"str","op2type":"nul","duration":"30","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":210,"y":360,"wires":[["46f44aa4.b9cd24"]]},{"id":"117964c9.fb88db","type":"function","z":"992f387a.5cea28","name":"saveVideoName","func":"var videoName=flow.get('videoName')||\"∅\";\n\n   videoName=msg.payload;\n   videoName;\n   flow.set('videoName',videoName);\n\n","outputs":1,"noerr":0,"x":880,"y":40,"wires":[["e44369a6.31bd88"]]},{"id":"60f6dd68.794834","type":"file in","z":"992f387a.5cea28","name":"file","filename":"/home/camera/helper","format":"utf8","chunk":false,"sendError":false,"x":690,"y":80,"wires":[["117964c9.fb88db"]]},{"id":"e1a9976a.5b5228","type":"mqtt in","z":"992f387a.5cea28","name":"","topic":"node/climate/thermometer/#","qos":"2","broker":"787db76e.6345b8","x":280,"y":920,"wires":[["cd65c2da.e725a"]]},{"id":"cd65c2da.e725a","type":"function","z":"992f387a.5cea28","name":"saveThermometer","func":"var tempO=flow.get('tempO')||\"∅\";\n\nif(msg.topic===\"node/climate/thermometer/0:73/temperature\"){\n   tempO=msg.payload;\n   flow.set('tempO',tempO);\n}\n","outputs":1,"noerr":0,"x":570,"y":860,"wires":[["e44369a6.31bd88"]]},{"id":"f9800052.2619d","type":"debug","z":"992f387a.5cea28","name":"dokument","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1240,"y":80,"wires":[]},{"id":"f35f1198.26b","type":"debug","z":"992f387a.5cea28","name":"master","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1350,"y":280,"wires":[]},{"id":"ae836e67.31957","type":"mqtt in","z":"992f387a.5cea28","name":"","topic":"node/climate/thermometer/#","qos":"2","broker":"787db76e.6345b8","x":440,"y":1020,"wires":[["45d0b50d.66cb6c"]]},{"id":"45d0b50d.66cb6c","type":"debug","z":"992f387a.5cea28","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":740,"y":1020,"wires":[]},{"id":"368c18c2.2499a8","type":"timerswitch","z":"992f387a.5cea28","name":"","ontopic":"calendar","offtopic":"calendar","onpayload":"on","offpayload":"off","disabled":false,"schedules":[{"on_h":"09","on_m":"00","on_s":"04","off_h":"11","off_m":"30","off_s":"00","valid":true}],"x":210,"y":80,"wires":[["4bdc49bc.9b9158"]]},{"id":"46f44aa4.b9cd24","type":"delay","z":"992f387a.5cea28","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":320,"y":260,"wires":[["a8481115.81abb"]]},{"id":"16b5f014.5ede5","type":"change","z":"992f387a.5cea28","name":"","rules":[{"t":"set","p":"allow","pt":"msg","to":"yes","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":280,"wires":[["e44369a6.31bd88"]]},{"id":"b8530de1.72a01","type":"delay","z":"992f387a.5cea28","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":680,"y":200,"wires":[["16b5f014.5ede5"]]},{"id":"f95a88bd.9b1248","type":"mqtt in","z":"992f387a.5cea28","name":"pir","topic":"node/pir/#","qos":"2","broker":"787db76e.6345b8","x":70,"y":520,"wires":[["66bee43f.2eb54c"]]},{"id":"787db76e.6345b8","type":"mqtt-broker","z":"","name":"bigClown","broker":"192.168.2.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"eb2315be.2a8ad8","type":"mongodb","z":"","hostname":"193.150.15.13","port":"27017","db":"myDB","name":"mongo"}]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top