My first attempt (basically just a test) to use Node Red and Pimoroni's Flotilla Medium kit. It connects to a flotilla daemon via Web Sockets and display weather data into debug console. Inspired by this blog post. First value in the output is a temperature (deg. * 100), second - athmospheric pressure (hPa * 100).
-
-
Save graycrow/fc0c2dcf6fa26282425a to your computer and use it in GitHub Desktop.
Pimoroni's Flotilla First Steps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"36ac24c8.c953dc","type":"websocket-client","z":"d18c8454.2e7378","path":"ws://127.0.0.1:9395","wholemsg":"false"},{"id":"178dd4ed.e8722b","type":"inject","z":"d18c8454.2e7378","name":"","topic":"","payload":"ready","payloadType":"string","repeat":"","crontab":"","once":true,"x":90,"y":39,"wires":[["f06cf209.0f931"]]},{"id":"63c7302.f9c38d","type":"websocket in","z":"d18c8454.2e7378","name":"","server":"","client":"36ac24c8.c953dc","x":132,"y":100,"wires":[["fa451781.05bae8"]]},{"id":"f06cf209.0f931","type":"websocket out","z":"d18c8454.2e7378","name":"","server":"","client":"36ac24c8.c953dc","x":295,"y":39,"wires":[]},{"id":"fa451781.05bae8","type":"function","z":"d18c8454.2e7378","name":"Extract Message","func":"var payload, d, c, m, details;\n \n payload = msg.payload.slice(6);\n \nswitch(payload[0]){\n case 'u': // Flotilla Update\n d = payload.trim().split(' ');\n d.shift();\n details = d.shift().split('/');\n c = details[0];\n m = details[1];\n node.send([\n {payload:{'event':'update','channel':c, 'module':m, 'values':d}},\n null,\n null\n ]);\n break;\n case 'd': // Flotilla Disconnect\n return null;\n case 'c': // Flotilla Connect\n return null;\n default:\n return null;\n}","outputs":1,"noerr":0,"x":377,"y":100,"wires":[["a5adb337.5a525"]]},{"id":"4c2ad5d1.b3d52c","type":"function","z":"d18c8454.2e7378","name":"Filter Weather Values","func":"if( msg.payload.module == 'weather'){\n msg.payload = msg.payload.values[0];\n return msg;\n}\nreturn null;","outputs":1,"noerr":0,"x":621,"y":171,"wires":[["f218a277.0de76"]]},{"id":"f218a277.0de76","type":"debug","z":"d18c8454.2e7378","name":"","active":true,"console":"false","complete":"payload","x":602,"y":258,"wires":[]},{"id":"a5adb337.5a525","type":"delay","z":"d18c8454.2e7378","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":599,"y":99,"wires":[["4c2ad5d1.b3d52c"]]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment