Parsing flow for LEDBorg

Developed by Andrew Lambourne at Blackgang Pi (February 2016).

To detect "mood" and "qualifier" in a payload and convert to suitable lighting triplet in message.

[{"id":"1377286f.534e54","type":"inject","name":"","topic":"","payload":"cold","payloadType":"string","repeat":"","crontab":"","once":false,"x":88,"y":65,"z":"a3985c94.0f853","wires":[["c0fecff6.a11f48"]]},{"id":"9d66a66e.18d7e8","type":"switch","name":"very","property":"payload","rules":[{"t":"cont","v":"very"},{"t":"else"}],"checkall":"true","outputs":2,"x":426,"y":66,"z":"a3985c94.0f853","wires":[["e22092be.7345"],["d94666ec.ee7b28"]]},{"id":"e22092be.7345","type":"change","name":"full intensity","rules":[{"t":"set","p":"intensity","to":"1"}],"action":"","property":"","from":"","to":"","reg":false,"x":585,"y":60,"z":"a3985c94.0f853","wires":[["d94666ec.ee7b28"]]},{"id":"bd7df269.d6a8b","type":"change","name":"red full","rules":[{"t":"set","p":"hue","to":"200"}],"action":"","property":"","from":"","to":"","reg":false,"x":737,"y":150,"z":"a3985c94.0f853","wires":[["3a4708c6.1c5c74"]]},{"id":"d94666ec.ee7b28","type":"switch","name":"angry","property":"payload","rules":[{"t":"cont","v":"angry"},{"t":"else"}],"checkall":"true","outputs":2,"x":433,"y":180,"z":"a3985c94.0f853","wires":[["138f7496.c12a7b"],["3a4708c6.1c5c74"]]},{"id":"f79556ca.aa098","type":"switch","name":"cold","property":"payload","rules":[{"t":"cont","v":"cold"},{"t":"else"}],"checkall":"true","outputs":2,"x":425,"y":351,"z":"a3985c94.0f853","wires":[["562ae109.1a2698"],["ce79bae0.81ee3","fbebc0fc.1f9f78"]]},{"id":"c0fecff6.a11f48","type":"change","name":"zero intensity","rules":[{"t":"set","p":"intensity","to":"0"}],"action":"","property":"","from":"","to":"","reg":false,"x":252,"y":64,"z":"a3985c94.0f853","wires":[["7702d6ab.3c31ac"]]},{"id":"7702d6ab.3c31ac","type":"change","name":"zero colour","rules":[{"t":"set","p":"hue","to":"0"}],"action":"","property":"","from":"","to":"","reg":false,"x":284,"y":126,"z":"a3985c94.0f853","wires":[["9d66a66e.18d7e8"]]},{"id":"ce79bae0.81ee3","type":"debug","name":"","active":true,"console":"false","complete":"true","x":589,"y":437,"z":"a3985c94.0f853","wires":[]},{"id":"3a4708c6.1c5c74","type":"switch","name":"happy","property":"payload","rules":[{"t":"cont","v":"happy"},{"t":"else"}],"checkall":"true","outputs":2,"x":428,"y":255,"z":"a3985c94.0f853","wires":[["31bc836e.cae1f"],["f79556ca.aa098"]]},{"id":"9fcc3da1.b4244","type":"inject","name":"","topic":"","payload":"angry","payloadType":"string","repeat":"","crontab":"","once":false,"x":83,"y":117,"z":"a3985c94.0f853","wires":[["c0fecff6.a11f48"]]},{"id":"36742e85.9e392a","type":"inject","name":"","topic":"","payload":"happy","payloadType":"string","repeat":"","crontab":"","once":false,"x":84,"y":177,"z":"a3985c94.0f853","wires":[["c0fecff6.a11f48"]]},{"id":"42e1e05e.757514","type":"inject","name":"","topic":"","payload":"very cold","payloadType":"string","repeat":"","crontab":"","once":false,"x":90,"y":233,"z":"a3985c94.0f853","wires":[["c0fecff6.a11f48"]]},{"id":"7a59558c.d48a44","type":"inject","name":"","topic":"","payload":"very angry","payloadType":"string","repeat":"","crontab":"","once":false,"x":89,"y":292,"z":"a3985c94.0f853","wires":[["c0fecff6.a11f48"]]},{"id":"73bb0f08.35a20c","type":"inject","name":"","topic":"","payload":"very happy","payloadType":"string","repeat":"","crontab":"","once":false,"x":90,"y":343,"z":"a3985c94.0f853","wires":[["c0fecff6.a11f48"]]},{"id":"138f7496.c12a7b","type":"switch","name":"","property":"intensity","rules":[{"t":"eq","v":"1"},{"t":"else"}],"checkall":"true","outputs":2,"x":590,"y":173,"z":"a3985c94.0f853","wires":[["bd7df269.d6a8b"],["e751d753.2ade7"]]},{"id":"e751d753.2ade7","type":"change","name":"red half","rules":[{"t":"set","p":"hue","to":"100"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":196,"z":"a3985c94.0f853","wires":[["3a4708c6.1c5c74"]]},{"id":"31bc836e.cae1f","type":"switch","name":"","property":"intensity","rules":[{"t":"eq","v":"1"},{"t":"else"}],"checkall":"true","outputs":2,"x":585,"y":252,"z":"a3985c94.0f853","wires":[["60042d32.f8abfc"],["fb01c800.b0fb48"]]},{"id":"60042d32.f8abfc","type":"change","name":"green full","rules":[{"t":"set","p":"hue","to":"020"}],"action":"","property":"","from":"","to":"","reg":false,"x":732,"y":229,"z":"a3985c94.0f853","wires":[["f79556ca.aa098"]]},{"id":"fb01c800.b0fb48","type":"change","name":"green half","rules":[{"t":"set","p":"hue","to":"010"}],"action":"","property":"","from":"","to":"","reg":false,"x":735,"y":275,"z":"a3985c94.0f853","wires":[["f79556ca.aa098"]]},{"id":"562ae109.1a2698","type":"switch","name":"","property":"intensity","rules":[{"t":"eq","v":"1"},{"t":"else"}],"checkall":"true","outputs":2,"x":593,"y":342,"z":"a3985c94.0f853","wires":[["7900b5ea.103bdc"],["e227c86.a65a9b8"]]},{"id":"7900b5ea.103bdc","type":"change","name":"blue full","rules":[{"t":"set","p":"hue","to":"002"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":319,"z":"a3985c94.0f853","wires":[["ce79bae0.81ee3","fbebc0fc.1f9f78"]]},{"id":"e227c86.a65a9b8","type":"change","name":"blue half","rules":[{"t":"set","p":"hue","to":"001"}],"action":"","property":"","from":"","to":"","reg":false,"x":743,"y":365,"z":"a3985c94.0f853","wires":[["ce79bae0.81ee3","fbebc0fc.1f9f78"]]},{"id":"618da550.c58c34","type":"ledborg","name":"","x":588,"y":482,"z":"a3985c94.0f853","wires":[]},{"id":"fbebc0fc.1f9f78","type":"function","name":"","func":"var newmessage={payload:msg.hue};\nreturn newmessage;","outputs":1,"noerr":0,"x":441,"y":484,"z":"a3985c94.0f853","wires":[["618da550.c58c34"]]}]
NeilCFord

Flow Info

created 1 year, 2 months ago

Node Types

Core
  • change (x9)
  • debug (x1)
  • function (x1)
  • inject (x6)
  • switch (x7)
Other

Tags

  • raspberrypi
  • ledborg
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option