mirror of
/repos/node-red-data.git
synced 2025-12-30 08:01:32 +01:00
1 line
13 KiB
JSON
1 line
13 KiB
JSON
[{"type":"tab","id":"6099285d.9f66d8","label":"Tutorial1"},{"type":"tab","id":"ebe7946c.141868","label":"Tutorial2"},{"type":"tab","id":"206a4ad5.df95b6","label":"Makerspace"},{"type":"tab","id":"17070e01.e8f8f2","label":"Sheet 1"},{"type":"tab","id":"14b8e8e5.eb4717","label":"prototyper"},{"type":"tab","id":"77e1c188.881e4","label":"node1"},{"id":"2cd412cc.d32bee","type":"subflow","name":"Subflow 1","in":[{"x":70,"y":70,"wires":[]}],"out":[{"x":667,"y":425,"wires":[]},{"x":559,"y":172,"wires":[{"id":"2cd412cc.d32bee","port":0}]}]},{"id":"a4462e69.5bb9d","type":"mqtt-broker","broker":"space.makerspaceleiden.nl","port":"1883","clientid":""},{"id":"d7663aaf.47194","type":"arduino-board","device":"/dev/ttyUSB0"},{"id":"ca3c92a0.35c37","type":"mqtt-broker","broker":"node1.aiko.sh","port":"1883","clientid":""},{"id":"13257eec.669069","type":"websocket-listener","path":"/ws/stations","wholemsg":"false"},{"id":"7b9bfb4b.846404","type":"mqtt-broker","broker":"node1.aiko.sh","port":"1883","clientid":"prototyper.local"},{"id":"933109d6.6ccef8","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":107,"y":51,"z":"6099285d.9f66d8","wires":[["438ad32f.bc752c"]]},{"id":"7db4644.f824b9c","type":"debug","name":"","active":true,"console":"false","complete":"false","x":646,"y":25,"z":"6099285d.9f66d8","wires":[]},{"id":"4c240132.b3dc","type":"function","name":"","func":"// Create a Date object from the payload\nvar date = new Date(msg.payload);\n// Change the payload to be a formatted Date string\nmsg.payload = date.toString();\n// Return the message so it can be sent on\nreturn msg;","outputs":1,"valid":true,"x":362,"y":214,"z":"6099285d.9f66d8","wires":[["7db4644.f824b9c"]]},{"id":"258ec189.da713e","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":98,"y":71,"z":"ebe7946c.141868","wires":[["7839bcb9.87c644"]]},{"id":"7839bcb9.87c644","type":"http request","name":"","method":"GET","ret":"txt","url":"http://realtimeweb-prod.nationalgrid.com/SystemData.aspx","x":255,"y":334,"z":"ebe7946c.141868","wires":[["eba3cc1d.145c3"]]},{"id":"eba3cc1d.145c3","type":"function","name":"","func":"\n// does a simple text extract parse of the http output to provide an\n// object containing the uk power demand, frequency and time\n\nif (~msg.payload.indexOf('<span')) {\n var dem = msg.payload.split('Demand:')[1].split(\"MW\")[0];\n var fre = msg.payload.split('Frequency:')[1].split(\"Hz\")[0];\n\n msg.payload = {};\n msg.payload.demand = parseInt(dem.split(\">\")[1].split(\"<\")[0]);\n msg.payload.frequency = parseFloat(fre.split(\">\")[1].split(\"<\")[0]);\n\n msg2 = {};\n msg2.payload = (msg.payload.frequency >= 50) ? true : false;\n\n return [msg,msg2];\n}\nreturn null;","outputs":"2","valid":true,"x":437,"y":549,"z":"ebe7946c.141868","wires":[["e6ac0ba4.1953f8","2022fb0a.dfdd04"],["cdf1251.f320ed8"]]},{"id":"e6ac0ba4.1953f8","type":"debug","name":"","active":true,"console":"false","complete":"false","x":664,"y":148,"z":"ebe7946c.141868","wires":[]},{"id":"cdf1251.f320ed8","type":"debug","name":"","active":true,"console":"false","complete":"false","x":658,"y":673,"z":"ebe7946c.141868","wires":[]},{"id":"7958a935.86a758","type":"mqtt in","name":"space.makerspace","topic":"#","broker":"","x":134,"y":92,"z":"206a4ad5.df95b6","wires":[["21db3474.de24cc","67392da8.98c6d4"]]},{"id":"5111ab58.aeee54","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":398,"y":82,"z":"206a4ad5.df95b6","wires":[]},{"id":"21db3474.de24cc","type":"freeboard","name":"[Node-RED] Makerspace","x":413,"y":259,"z":"206a4ad5.df95b6","wires":[]},{"id":"2022fb0a.dfdd04","type":"freeboard","name":"demand/frequency","x":814,"y":337,"z":"ebe7946c.141868","wires":[]},{"id":"b38975fe.4c7688","type":"debug","name":"","active":true,"console":"false","complete":"false","x":650,"y":196,"z":"17070e01.e8f8f2","wires":[]},{"id":"4c3e5d60.b3c1a4","type":"http request","name":"version","method":"GET","ret":"obj","url":"https://uat-opscentre.informaat-cxp.com/version","x":397,"y":221,"z":"17070e01.e8f8f2","wires":[["b38975fe.4c7688","f5d1da8a.0a2e28"]]},{"id":"7fde5375.8021ac","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":200,"y":140,"z":"17070e01.e8f8f2","wires":[["4c3e5d60.b3c1a4"]]},{"id":"f5d1da8a.0a2e28","type":"freeboard","name":"version","x":659,"y":322,"z":"17070e01.e8f8f2","wires":[]},{"id":"438ad32f.bc752c","type":"snmp","host":"nas.aiko.sh","community":"public","version":"1","oids":"1.3.6.1.4.1.2021.11.9.0, 1.3.6.1.4.1.2021.11.10.0, 1.3.6.1.2.1.31.1.1.1.1.1","name":"","x":278,"y":483,"z":"6099285d.9f66d8","wires":[["54010b41.abfef4"]]},{"id":"54010b41.abfef4","type":"debug","name":"","active":true,"console":"false","complete":"false","x":628,"y":422,"z":"6099285d.9f66d8","wires":[]},{"id":"ab6bee99.54941","type":"debug","name":"","active":true,"console":"false","complete":"true","x":600,"y":598,"z":"6099285d.9f66d8","wires":[]},{"id":"959b1dd0.6a64e","type":"discovery","name":"AFP sources","topic":"","service":"_afpovertcp._tcp","x":184,"y":771,"z":"6099285d.9f66d8","wires":[["ab6bee99.54941"]]},{"id":"5a6d25d0.a592dc","type":"comment","name":"AVAHI notes","info":"* https://github.com/agnat/node_mdns/issues/104\n* http://www.noah.org/wiki/Avahi_Notes","x":185,"y":808,"z":"6099285d.9f66d8","wires":[]},{"id":"bcda1072.4325f","type":"comment","name":"NAS snmp","info":"* http://ukdl.synology.com/download/Document/MIBGuide/Synology_DiskStation_MIB_Guide.pdf","x":267,"y":519,"z":"6099285d.9f66d8","wires":[]},{"id":"890dc688.76f238","type":"arduino out","name":"","pin":"13","state":"OUTPUT","arduino":"","x":732,"y":318.0000047683716,"z":"2cd412cc.d32bee","wires":[]},{"id":"65fd2a77.9a02d4","type":"inject","name":"tick","topic":"","payload":"","payloadType":"date","repeat":"0.5","once":false,"x":339.00000762939453,"y":218,"z":"2cd412cc.d32bee","wires":[["2fe931de.d016ce"]]},{"id":"2fe931de.d016ce","type":"function","name":"Toggle output on input","func":"\n// initialise level as a context variable if currently undefined \n// (context variables persist between calls to the function)\ncontext.level = context.level || false;\n\n// if it's a 0 make it a 1 else make it a 0...\ncontext.level = !context.level;\n\n// set the payload to the level and return\nmsg.payload = context.level;\nreturn msg;","outputs":1,"valid":true,"x":521.0000038146973,"y":268.9999895095825,"z":"2cd412cc.d32bee","wires":[["890dc688.76f238"]]},{"id":"67392da8.98c6d4","type":"mqtt out","name":"node1.makerspace","topic":"makerspace","qos":"0","retain":"true","broker":"ca3c92a0.35c37","x":376,"y":375,"z":"206a4ad5.df95b6","wires":[]},{"id":"92dbc8f4.6d2438","type":"http in","name":"","url":"/mapstations","method":"get","x":272,"y":547,"z":"17070e01.e8f8f2","wires":[["877b9488.788468"]]},{"id":"58de8e7d.a7217","type":"http response","name":"","x":621,"y":544,"z":"17070e01.e8f8f2","wires":[]},{"id":"7745e2fd.88ba1c","type":"http request","name":"","method":"GET","url":"http://api.bart.gov/api/stn.aspx?cmd=stns&key=MW9S-E7SL-26DU-VV8V","x":425,"y":639,"z":"17070e01.e8f8f2","wires":[["430be461.bcf41c"]]},{"id":"430be461.bcf41c","type":"xml","name":"","x":578,"y":639,"z":"17070e01.e8f8f2","wires":[["573512a3.a8caec"]]},{"id":"877b9488.788468","type":"template","name":"","field":"payload","format":"html","template":"<!DOCTYPE html>\n<html>\n <head>\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\">\n <meta charset=\"utf-8\">\n <title>Bart Stations</title>\n <style>\n html, body, #map-canvas {\n height: 100%;\n margin: 0px;\n padding: 0px\n }\n </style>\n <script src=\"https://maps.googleapis.com/maps/api/js?v=3.exp\"></script>\n <script>\n\t\tfunction initialize() {\n\t\t var myLatlng = new google.maps.LatLng(37.765062,-122.419694);\n\t\t var mapOptions = {\n\t\t zoom: 10,\n\t\t center: myLatlng\n\t\t };\n\t\t var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);\n\t\t \n\t\t var loc = window.location;\n if (loc.protocol === \"https:\") {\n newUri = \"wss:\";\n } else {\n newUri = \"ws:\";\n }\n newUri += \"//\" + loc.host + \"/ws/stations\";\n\t\t \n\t\t \n\t\t var sock = new WebSocket(newUri);\n\t\t sock.onopen = function(){ \n\t\t console.log(\"Connected websocket\");\n\t\t console.log(\"Sending ping..\");\n\t\t\tsock.send(\"Ping!\");\n\t\t console.log(\"Ping sent..\");\n\t\t };\n\t\t sock.onerror = function(){ console.log(\"Websocket error\"); };\n\t\t sock.onmessage = function(evt){\n\t\t var stationData = JSON.parse(evt.data);\n\t\t var stations = stationData.root.stations[0].station;\n\t\t\tfor(var i = 0; i < stations.length; i++) {\n\t\t\t var station = stations[i];\n var marker = new google.maps.Marker({\n\t\t\t position: new google.maps.LatLng(station.gtfs_latitude[0],station.gtfs_longitude[0]),\n\t\t\t map: map,\n\t\t\t animation: google.maps.Animation.DROP,\n\t\t\t title: station.name[0]\n\t\t\t });\n\t\t\t \n\t\t\t}\n\t\t };\n\t\t};\n\t\t\n\t\tgoogle.maps.event.addDomListener(window, 'load', initialize);\n\n </script>\n </head>\n <body>\n <div id=\"map-canvas\"></div>\n </body>\n</html>","x":456,"y":546,"z":"17070e01.e8f8f2","wires":[["58de8e7d.a7217"]]},{"id":"bf1e6d80.40e19","type":"websocket in","name":"","server":"13257eec.669069","x":252,"y":640,"z":"17070e01.e8f8f2","wires":[["7745e2fd.88ba1c"]]},{"id":"573512a3.a8caec","type":"websocket out","name":"","server":"13257eec.669069","x":763,"y":639,"z":"17070e01.e8f8f2","wires":[]},{"id":"dcb3b8c6.234c48","type":"mqtt in","name":"","topic":"prototyper/sensors/temp/cpu","broker":"ca3c92a0.35c37","x":132,"y":131,"z":"14b8e8e5.eb4717","wires":[["9ec2b694.613d48"]]},{"id":"89493987.76b6c8","type":"debug","name":"","active":true,"console":"false","complete":"false","x":498,"y":79,"z":"14b8e8e5.eb4717","wires":[]},{"id":"93531fa4.6cace","type":"mqtt in","name":"","topic":"prototyper/status/uptime","broker":"ca3c92a0.35c37","x":129,"y":252,"z":"14b8e8e5.eb4717","wires":[["2b5ccd67.d4a332"]]},{"id":"cc34952.f33cb68","type":"mqtt in","name":"","topic":"prototyper/status/pm2","broker":"ca3c92a0.35c37","x":120,"y":361,"z":"14b8e8e5.eb4717","wires":[["fe42d1ff.01bd3"]]},{"id":"43340c14.bccbf4","type":"freeboard","name":"prototyper-cpu","x":543,"y":124,"z":"14b8e8e5.eb4717","wires":[]},{"id":"492a4e99.b6d5b","type":"freeboard","name":"prototyper-uptime","x":540,"y":245,"z":"14b8e8e5.eb4717","wires":[]},{"id":"d4d9a328.2b266","type":"freeboard","name":"prototyper-pm2","x":535,"y":366,"z":"14b8e8e5.eb4717","wires":[]},{"id":"fe42d1ff.01bd3","type":"json","name":"","x":341,"y":367,"z":"14b8e8e5.eb4717","wires":[["d4d9a328.2b266"]]},{"id":"2b5ccd67.d4a332","type":"json","name":"","x":337,"y":252,"z":"14b8e8e5.eb4717","wires":[["492a4e99.b6d5b"]]},{"id":"9ec2b694.613d48","type":"json","name":"","x":367,"y":130,"z":"14b8e8e5.eb4717","wires":[["43340c14.bccbf4"]]},{"id":"6cfed323.93012c","type":"mqtt in","name":"","topic":"prototyper/status/loadavg","broker":"ca3c92a0.35c37","x":120,"y":443,"z":"14b8e8e5.eb4717","wires":[["240754b3.dbf8ac"]]},{"id":"b98b8413.467478","type":"freeboard","name":"prototyper-loadavg","x":543,"y":447,"z":"14b8e8e5.eb4717","wires":[]},{"id":"240754b3.dbf8ac","type":"json","name":"","x":337,"y":447,"z":"14b8e8e5.eb4717","wires":[["b98b8413.467478"]]},{"id":"18ae13e2.e751ec","type":"mqtt in","name":"","topic":"prototyper/status/meminfo","broker":"ca3c92a0.35c37","x":133,"y":527,"z":"14b8e8e5.eb4717","wires":[["e9a010b3.165ff"]]},{"id":"f08b1c6b.0f74e","type":"freeboard","name":"prototyper-meminfo","x":556,"y":531,"z":"14b8e8e5.eb4717","wires":[]},{"id":"e9a010b3.165ff","type":"json","name":"","x":350,"y":531,"z":"14b8e8e5.eb4717","wires":[["f08b1c6b.0f74e"]]},{"id":"2d3ece06.d2c132","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"60","crontab":"","once":false,"x":101,"y":117,"z":"77e1c188.881e4","wires":[["6639f12.f99c61"]]},{"id":"6639f12.f99c61","type":"exec","command":"pm2","addpay":true,"append":"jlist","useSpawn":"","name":"","x":299,"y":125,"z":"77e1c188.881e4","wires":[["bfc5505d.403ab"],[],[]]},{"id":"bfc5505d.403ab","type":"json","name":"","x":503,"y":130,"z":"77e1c188.881e4","wires":[["a3e540e6.5c1ac"]]},{"id":"a3e540e6.5c1ac","type":"mqtt out","name":"","topic":"node1/status/pm2","qos":"","retain":"true","broker":"ca3c92a0.35c37","x":776,"y":129,"z":"77e1c188.881e4","wires":[]},{"id":"7354ef5f.8cab1","type":"mqtt in","name":"","topic":"node1/status/pm2","broker":"ca3c92a0.35c37","x":145,"y":254,"z":"77e1c188.881e4","wires":[["b4c616bc.4b39e8"]]},{"id":"ea12cfff.15ed3","type":"freeboard","name":"node1-pm2","x":560,"y":259,"z":"77e1c188.881e4","wires":[]},{"id":"b4c616bc.4b39e8","type":"json","name":"","x":366,"y":260,"z":"77e1c188.881e4","wires":[["ea12cfff.15ed3"]]}] |