I've been searching the extra nodes and flows (a collection of nodes and functions added together to perform an action) that can be found here http://flows.nodered.org/ and found quite a few really useful contributions.
I decided to publish a simple flow that I created to switch on/off an LED connected to Pin11 of my RPi using my phone and Pushbullet.
Pushbullet is an app for Android, PCs (Chrome) and Iphones to broadcast information between your devices, for example I can get the notifications that appear on my Android phone to pop-up on my PC when I'm using the Google Chrome plugin.
What this flow does is when I send a push note from my phone containing the words "LED on" the push server sends it to my devices including the node on the RPi server the flow then sends a 1 to the output pin of the RPi switching the LED on and then sends a push note back to the phone with a confirmation "LED is on". Sending "LED off" switches the LED off.
All this without having to know any Python at all..... brilliant!
The flow is available on GitHub Gist here or you can just copy the text below and paste it into the import from clipboard in node-red.
[{"id":"8cc62775.7339d8","type":"pushbullet-config","name":"Phil Grant"},{"id":"36bc98c5.c94368","type":"inject","name":"LED on","topic":"","payload":"LED on","payloadType":"string","repeat":"","crontab":"","once":false,"x":507,"y":450,"z":"6a77b09e.95885","wires":[["2b89fef6.d47602"]]},{"id":"2b89fef6.d47602","type":"switch","name":"LED Control","property":"payload","rules":[{"t":"eq","v":"LED on"},{"t":"eq","v":"LED off"}],"checkall":"true","outputs":2,"x":655,"y":504,"z":"6a77b09e.95885","wires":[["89d6dac1.762928","dba96b7a.245698"],["f6e1a3b9.091e6","cd9a199b.3265e8"]]},{"id":"dd181fd3.22e7e","type":"pushbullet in","config":"8cc62775.7339d8","name":"Push input","x":488,"y":505,"z":"6a77b09e.95885","wires":[["2b89fef6.d47602"]]},{"id":"89d6dac1.762928","type":"template","name":"On","field":"payload","format":"handlebars","template":"1","x":856,"y":487,"z":"6a77b09e.95885","wires":[["69f3331c.960ccc"]]},{"id":"dba96b7a.245698","type":"template","name":"LED is On","field":"payload","format":"handlebars","template":"LED is On","x":865,"y":453,"z":"6a77b09e.95885","wires":[["e69cd2aa.19633"]]},{"id":"f6e1a3b9.091e6","type":"template","name":"off","field":"payload","format":"handlebars","template":"0","x":855,"y":531,"z":"6a77b09e.95885","wires":[["69f3331c.960ccc"]]},{"id":"cd9a199b.3265e8","type":"template","name":"LED is Off","field":"payload","format":"handlebars","template":"LED is off","x":865,"y":564,"z":"6a77b09e.95885","wires":[["c099b247.3f665"]]},{"id":"1d5efe9b.e2a101","type":"inject","name":"LED Off","topic":"","payload":"LED off","payloadType":"string","repeat":"","crontab":"","once":false,"x":501,"y":568,"z":"6a77b09e.95885","wires":[["2b89fef6.d47602"]]},{"id":"69f3331c.960ccc","type":"rpi-gpio out","name":"Pin 11","pin":"11","set":true,"level":"0","out":"out","x":1024,"y":507,"z":"6a77b09e.95885","wires":[]},{"id":"e69cd2aa.19633","type":"pushbullet","config":"8cc62775.7339d8","pushtype":"note","title":"LED Status","chan":"","name":"LED is On","x":1032,"y":453,"z":"6a77b09e.95885","wires":[]},{"id":"c099b247.3f665","type":"pushbullet","config":"8cc62775.7339d8","pushtype":"note","title":"LED Status","chan":"","name":"LED is Off","x":1031,"y":564,"z":"6a77b09e.95885","wires":[]}]
No comments:
Post a Comment