Sensor hub for JeeNode / Open Energy Monitor

This flow interfaces with a http://jeelabs.com/ JeeNode or JeeLink to bridge mqtt topics to remote sensors based on Jeelab's RFM12B wireless implementation.

The flow will deliver messages from the sensor network to the mqtt topic: rfm12b/ and forward messages to the sensor network from mqtt topic: rfm12b/out/

The flow also contains examples of how sensor nodes can be mapped to functional mqtt topics.

See the following blog post for more details:

https://www.ibm.com/developerworks/community/blogs/B-Fool/entry/home_automation_with_node_red_jeenodes_and_the_oen_energy_monitor_project?lang=en

N.B. This flow requires the serialport node to be installed in the Node Red environment (npm install serialport). Serialport requires node.js to compile native code - on Linux this will just work. If you are running Windows you will require a Visual Studio compiler (https://github.com/TooTallNate/node-gyp/wiki/Visual-Studio-2010-Setup).

If you are running a mac you will need XCode (command line tools will also work).

[{"id":"cbc83a97.92b9f8","type":"serial-port","serialport":"COM2","serialbaud":"57600","newline":"\\r\\n"},{"id":"ba386057.845d3","type":"mqtt-broker","broker":"localhost","port":"1883"},{"id":"47b4ffb0.7f678","type":"function","name":"Parse RF12B ","func":"// console.log(msg.topic, msg.payload, msg.qos, msg.retain);\n// context = {};\n\n//we are expecting data in form \"OK nodeid data1 data2 etc\"\nvar tokens = msg.payload.split(\" \"); \nvar outString = null;\nvar outTopic;\nif (tokens.shift() == \"OK\")\n{\n   var nodeid = tokens.shift() & 0x1F;\n  outString = tokens;\n   outTopic = 'rfm12b/' + nodeid;\n}\nelse\n{\nreturn null;\n}\n\nvar msg2 = { payload:outString, topic:outTopic};\nreturn msg2;","outputs":"1","x":331,"y":123,"z":"aa7bf422.ba91a","wires":[["d421eb9e.f831f8"]]},{"id":"d421eb9e.f831f8","type":"mqtt out","name":"Publish RFM12B","topic":"","broker":"ba386057.845d3","x":508,"y":123,"z":"aa7bf422.ba91a","wires":[]},{"id":"5335d2f5.b0a45c","type":"serial in","name":"","serial":"cbc83a97.92b9f8","x":136,"y":122,"z":"aa7bf422.ba91a","wires":[["47b4ffb0.7f678","886d1812.b2db18"]]},{"id":"4beca0d4.9b8d78","type":"serial out","name":"","serial":"cbc83a97.92b9f8","x":508,"y":334,"z":"aa7bf422.ba91a","wires":[]},{"id":"f9a7507e.792368","type":"mqtt in","name":"RFM12B Sender","topic":"rfm12b/out/#","broker":"ba386057.845d3","x":133,"y":315,"z":"aa7bf422.ba91a","wires":[["df3c616d.dae01"]]},{"id":"e0c06e64.4b278","type":"debug","name":"sender debug","active":true,"complete":"false","x":513,"y":276,"z":"aa7bf422.ba91a","wires":[]},{"id":"df3c616d.dae01","type":"function","name":"Send to Node","func":"// The received message is stored in 'msg'\n// It will have at least a 'payload' property:\n//   console.log(msg.payload);\n// The 'context' object is available to store state\n// between invocations of the function\n//   context = {};\n\nvar dataStr = msg.payload;\n\n//if individual node selected - the destination id should be last part of topic\n\nvar tokens = msg.topic.split(\"/\");\nvar dest = tokens[tokens.length-1];\n\nif(dest == \"out\")\n{\n   dest = \"0\";\n}\n\nif(isNaN(dest))\n{\n  dataStr='NAN';\n  //return null;\n}\n\nmsg.payload = dataStr + \",\" + dest + \"s\";\n\n\nreturn msg;","outputs":1,"x":298,"y":316,"z":"aa7bf422.ba91a","wires":[["e0c06e64.4b278","4beca0d4.9b8d78"]]},{"id":"886d1812.b2db18","type":"debug","name":"Serial In Debug","active":true,"complete":"false","x":332.42852783203125,"y":194.85711669921875,"z":"aa7bf422.ba91a","wires":[]},{"id":"714ee31a.9ba12c","type":"mqtt out","name":"RFM12 Node 20 Out","topic":"rfm12b/out/20","broker":"ba386057.845d3","x":801,"y":527,"z":"aa7bf422.ba91a","wires":[]},{"id":"c07135ae.746ba8","type":"mqtt in","name":"LCD TIme","topic":"energymonitor/lcd/time","broker":"ba386057.845d3","x":549,"y":527,"z":"aa7bf422.ba91a","wires":[["714ee31a.9ba12c"]]},{"id":"c823205a.68a7c","type":"mqtt out","name":"RFM12 Node 6 OUT","topic":"rfm12b/out/6","broker":"ba386057.845d3","x":829,"y":428,"z":"aa7bf422.ba91a","wires":[]},{"id":"a57a5bc6.20cb7","type":"mqtt in","name":"Ambient Light Lounge 1","topic":"home/ambient/lounge/1","broker":"ba386057.845d3","x":593,"y":429,"z":"aa7bf422.ba91a","wires":[["c823205a.68a7c"]]},{"id":"3024dcd9.d6a494","type":"mqtt in","name":"RFM12 Node 16 IN","topic":"rfm12b/16","broker":"ba386057.845d3","x":131,"y":581,"z":"aa7bf422.ba91a","wires":[["430251b7.c820d8"]]},{"id":"430251b7.c820d8","type":"mqtt out","name":"Shed Node Raw","topic":"home/shed/node/raw","broker":"ba386057.845d3","x":344,"y":582,"z":"aa7bf422.ba91a","wires":[]},{"id":"ea57317e.3deb88","type":"mqtt in","name":"RFM12 Node 12 IN","topic":"rfm12b/12","broker":"ba386057.845d3","x":136,"y":481,"z":"aa7bf422.ba91a","wires":[["f0d7002e.f8eb78"]]},{"id":"f0d7002e.f8eb78","type":"mqtt out","name":"Loft Node Raw","topic":"home/loft/node/raw","broker":"ba386057.845d3","x":349,"y":482,"z":"aa7bf422.ba91a","wires":[]},{"id":"41c25ecc.b820e","type":"mqtt in","name":"RFM12 Node 14 IN","topic":"rfm12b/14","broker":"ba386057.845d3","x":135,"y":534,"z":"aa7bf422.ba91a","wires":[["2d4301a0.8dbace"]]},{"id":"2d4301a0.8dbace","type":"mqtt out","name":"Garage Node Raw","topic":"home/garage/node/raw","broker":"ba386057.845d3","x":348,"y":535,"z":"aa7bf422.ba91a","wires":[]},{"id":"4ad1ef65.e039e8","type":"mqtt out","name":"RFM12 Node 4 OUT","topic":"rfm12b/out/4","broker":"ba386057.845d3","x":827,"y":479,"z":"aa7bf422.ba91a","wires":[]},{"id":"798c523c.789ac4","type":"mqtt in","name":"Ambient Light Lounge 2","topic":"home/ambient/lounge/2","broker":"ba386057.845d3","x":591,"y":480,"z":"aa7bf422.ba91a","wires":[["4ad1ef65.e039e8"]]},{"id":"18eb4df4.26a0d2","type":"comment","name":"RFM12 Inbound","info":"","x":128,"y":69,"z":"aa7bf422.ba91a","wires":[]},{"id":"933a61e3.4ab5e","type":"comment","name":"RFM12 Outbound","info":"","x":135,"y":269,"z":"aa7bf422.ba91a","wires":[]},{"id":"9e859c88.ac248","type":"comment","name":"Inbound Node Mapping","info":"","x":148,"y":383,"z":"aa7bf422.ba91a","wires":[]},{"id":"a3b9a9d5.671c78","type":"comment","name":"Outbound Node Mapping","info":"","x":589,"y":385,"z":"aa7bf422.ba91a","wires":[]}]

Flow Info

Created 11 years, 2 months ago
Updated 9 years ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x4)
  • debug (x2)
  • function (x2)
  • mqtt in (x7)
  • mqtt out (x7)
  • mqtt-broker (x1)
Other
  • serial in (x1)
  • serial out (x1)
  • serial-port (x1)

Tags

  • jeenode
  • jeelink
  • Open
  • Energy
  • Monitor
  • RFM12B
  • 433MHZ
  • Nanode
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option