The Node is Red, long live the Node! I got back into the Pi recently after a few months off of fiddling with it. I had already made the sub board for the alarm, I decided to remake the temperature board as well (it didn’t work either). So I had the boards ready now I needed the software. I could try to put back together the original scripts I had, or I could just start fresh. I decided to start fresh. While Googling something (I don’t remember what) I came across Node-Red. Completely unfamiliar with it. I have seen Node.js here or there but thats it. Looked a little further and then I installed it. It’s awesome really. I am nit the best at Javascript so it’s a curve to me but the GUI makes up for that. I got Node-Red up and running on the Raspberry Pi in about 15 minutes. I won’t go into install details as they are out there already. What is not out there, or at least is very hard to find, are examples of GOOD flows, or tutorials on how to get things done. Like what code is needed to do the simple things, but I guess they are expecting you to know that already.
Getting Node-Red installed was easy, besides not finding much help on the web I also didn’t realize that you need to install all the modules you will be using before hand. So things like Twitter, Pushbullet, BMP temp sensors won’t work until those modules are installed. Installing was no problem, but it took the little RPi forever to install them all. I would say it took the better part of half a day to search and get them all loaded.
Because of the lack if examples (and my lack of JS) it took me a few days to figure out how to grab part of the URL and pass it to a page to spit it back at you. Simple right? So here it is, copy and pasted in all its glory (taken from http://sharpk60.blogspot.com/2014/10/first-steps-with-node-red.html):
1 |
[{"id":"d9b8ab02.264758","type":"http in","z":"5ac1a9e1.a53e58","name":"","url":"/test","method":"get","x":331.4285888671875,"y":368.5714416503906,"wires":[["979acd1a.68653"]]},{"id":"1c9a5505.e365ab","type":"debug","z":"5ac1a9e1.a53e58","name":"test URL","active":true,"console":"false","complete":"false","x":731.4285888671875,"y":280.5714416503906,"wires":[]},{"id":"a2120f84.5dedf","type":"http response","z":"5ac1a9e1.a53e58","name":"","x":722.4285888671875,"y":367.5714416503906,"wires":[]},{"id":"979acd1a.68653","type":"function","z":"5ac1a9e1.a53e58","name":"Gen response","func":"var resp = \"Hello \" + msg.payload.name;\nmsg.payload = resp;\nreturn msg;","outputs":1,"x":546.4285888671875,"y":367.5714416503906,"wires":[["a2120f84.5dedf","1c9a5505.e365ab"]]}] |
Discover more from Its_All.Lost
Subscribe to get the latest posts sent to your email.