-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodered-twitter.txt
1 lines (1 loc) · 8.34 KB
/
nodered-twitter.txt
1
[{"id":"6d23414e.6994","type":"debug","z":"a2ad46b2.3e6c18","name":"","active":true,"console":"false","complete":"false","x":1106,"y":692,"wires":[]},{"id":"67b5287e.92ef","type":"function","z":"a2ad46b2.3e6c18","name":"PM 2.5 and Time for Twitter","func":"// (1) wandelt timestamo ins ISO Datumformat um\n//msg.timestamp= new Date().toISOString()\n\n// (2) beliebiges Datum festlegbar: hier: YYYY-MM-DD HH:MM.SS\n// (Ausgabeformat wird danz am Ende zusammengestellt)\nvar now = new Date(); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \n\n\n// Variante1: wenn z.B. nicht ein vorhandener Payload\n// überschrieben werden soll, sondern um ein\n// Datum ergänzt werden soll. \n\n//msg.timestamp = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\n\n// Variante 2: Function gibt die aktuelle Zeit als payload aus\nnow = day+'-'+month+'-'+year+' '+hour+':'+minute+':'+second;\n\nmsg.payload = msg.payload.sensordatavalues[1].value \n// JSON Antwort parsen\nvar weather=JSON.parse(msg.payload);\n \n// Neue Nachricht mit Payload erstellen\nvar newMsg = { payload: \"Feinstaub 2.5PM : \"+weather + \" µg/m³\\r am \" +now};\n \n// Zurückgeben der Nachricht\nreturn [newMsg];\n","outputs":1,"noerr":0,"x":599,"y":687,"wires":[["6d23414e.6994","a6283889.d9d3b"]]},{"id":"a6283889.d9d3b","type":"delay","z":"a2ad46b2.3e6c18","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":857,"y":659,"wires":[["df682309.70d64"]]},{"id":"8602a07c.d1a928","type":"http request","z":"a2ad46b2.3e6c18","name":"","method":"GET","ret":"obj","url":"http://youripaddress.of.sensor/data.json","tls":"","x":317.6041564941406,"y":500.10418701171875,"wires":[["47475f74.f39978","9dcf1877.449f3","ee945c2d.fae678","67b5287e.92ef"]]},{"id":"df682309.70d64","type":"twitter out","z":"a2ad46b2.3e6c18","twitter":"","name":"Tweet","x":1104,"y":508,"wires":[]},{"id":"47475f74.f39978","type":"function","z":"a2ad46b2.3e6c18","name":"Temperature and Time for Twitter","func":"// (1) wandelt timestamo ins ISO Datumformat um\n//msg.timestamp= new Date().toISOString()\n\n// (2) beliebiges Datum festlegbar: hier: YYYY-MM-DD HH:MM.SS\n// (Ausgabeformat wird danz am Ende zusammengestellt)\nvar now = new Date(); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \n\n\n// Variante1: wenn z.B. nicht ein vorhandener Payload\n// überschrieben werden soll, sondern um ein\n// Datum ergänzt werden soll. \n\n//msg.timestamp = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\n\n// Variante 2: Function gibt die aktuelle Zeit als payload aus\nnow = day+'-'+month+'-'+year+' '+hour+':'+minute+':'+second;\n\nmsg.payload = msg.payload.sensordatavalues[2].value \n// JSON Antwort parsen\nvar weather=JSON.parse(msg.payload);\n \n// Neue Nachricht mit Payload erstellen\nvar newMsg = { payload: \"Außentemperatur: \"+weather + \" Grad\\r am \" +now};\n \n// Zurückgeben der Nachricht\nreturn [newMsg];\n","outputs":1,"noerr":0,"x":621,"y":503,"wires":[["3560ff13.cb1fa","df682309.70d64"]]},{"id":"9dcf1877.449f3","type":"function","z":"a2ad46b2.3e6c18","name":"Humidity and Time for Twitter","func":"// (1) wandelt timestamo ins ISO Datumformat um\n//msg.timestamp= new Date().toISOString()\n\n// (2) beliebiges Datum festlegbar: hier: YYYY-MM-DD HH:MM.SS\n// (Ausgabeformat wird danz am Ende zusammengestellt)\nvar now = new Date(); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \n\n\n// Variante1: wenn z.B. nicht ein vorhandener Payload\n// überschrieben werden soll, sondern um ein\n// Datum ergänzt werden soll. \n\n//msg.timestamp = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\n\n// Variante 2: Function gibt die aktuelle Zeit als payload aus\nnow = day+'-'+month+'-'+year+' '+hour+':'+minute+':'+second;\n\nmsg.payload = msg.payload.sensordatavalues[3].value \n// JSON Antwort parsen\nvar weather=JSON.parse(msg.payload);\n \n// Neue Nachricht mit Payload erstellen\nvar newMsg = { payload: \"Die aktuelle Luchtfeuchte in #München: \"+weather + \" %\\r am \" +now};\n \n// Zurückgeben der Nachricht\nreturn [newMsg];\n","outputs":1,"noerr":0,"x":605,"y":561,"wires":[["f34ccf63.52d27","1b0673f5.3352f4"]]},{"id":"ee945c2d.fae678","type":"function","z":"a2ad46b2.3e6c18","name":"PM 10 and Time for Twitter","func":"// (1) wandelt timestamo ins ISO Datumformat um\n//msg.timestamp= new Date().toISOString()\n\n// (2) beliebiges Datum festlegbar: hier: YYYY-MM-DD HH:MM.SS\n// (Ausgabeformat wird danz am Ende zusammengestellt)\nvar now = new Date(); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \n\n\n// Variante1: wenn z.B. nicht ein vorhandener Payload\n// überschrieben werden soll, sondern um ein\n// Datum ergänzt werden soll. \n\n//msg.timestamp = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\n\n// Variante 2: Function gibt die aktuelle Zeit als payload aus\nnow = day+'-'+month+'-'+year+' '+hour+':'+minute+':'+second;\n\nmsg.payload = msg.payload.sensordatavalues[0].value \n// JSON Antwort parsen\nvar weather=JSON.parse(msg.payload);\n \n// Neue Nachricht mit Payload erstellen\nvar newMsg = { payload: \"Feinstaub 10PM : \"+weather + \" µg/m³\\r am \" +now};\n \n// Zurückgeben der Nachricht\nreturn [newMsg];\n","outputs":1,"noerr":0,"x":609,"y":624,"wires":[["5cda9937.3f893","c64afe2f.640fd8"]]},{"id":"a500a4a4.68a2b8","type":"inject","z":"a2ad46b2.3e6c18","name":"","topic":"","payload":"","payloadType":"date","repeat":"3600","crontab":"","once":false,"x":130.10415649414062,"y":500.10418701171875,"wires":[["8602a07c.d1a928"]]},{"id":"1b0673f5.3352f4","type":"delay","z":"a2ad46b2.3e6c18","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":845,"y":529,"wires":[["df682309.70d64"]]},{"id":"c64afe2f.640fd8","type":"delay","z":"a2ad46b2.3e6c18","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":851,"y":601,"wires":[["df682309.70d64"]]},{"id":"3560ff13.cb1fa","type":"debug","z":"a2ad46b2.3e6c18","name":"","active":true,"console":"false","complete":"false","x":1101,"y":457,"wires":[]},{"id":"f34ccf63.52d27","type":"debug","z":"a2ad46b2.3e6c18","name":"","active":true,"console":"false","complete":"false","x":1102,"y":565,"wires":[]},{"id":"5cda9937.3f893","type":"debug","z":"a2ad46b2.3e6c18","name":"","active":true,"console":"false","complete":"false","x":1100,"y":625,"wires":[]}]