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":"52247c3a.addb84","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":""},{"id":"1041920c.efbe6e","type":"twitter in","twitter":"","tags":"cheerlights","user":"false","name":"","topic":"tweets","x":130,"y":136,"z":"edece394.12132","wires":[["d15fbafe.2ea048","ad98649a.526798"]]},{"id":"d15fbafe.2ea048","type":"debug","name":"","active":true,"complete":false,"x":542,"y":125,"z":"edece394.12132","wires":[]},{"id":"5d084303.a2f7bc","type":"mqtt out","name":"","topic":"smartstar/in","broker":"52247c3a.addb84","x":547,"y":240,"z":"edece394.12132","wires":[]},{"id":"ad98649a.526798","type":"function","name":"Cheerlights","func":"// Extract colours from Twitter String\n\nvar input = msg.payload;\nvar colours = input.toUpperCase().match(/\\b(red|blue|green|purple)\\b/ig);\nif (colours == null) { return }\n//console.log(\"colours:\" + colours);\n\nvar pattern = [];\ncolours.forEach(function(colour) {\n var cc = (colour == \"RED\") ? \"P\" : colour.charAt(0);\n \n console.log(\"Colour:\" + co |
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
// Extract colours from Twitter String | |
var input = msg.payload; | |
var colours = input.toUpperCase().match(/\b(red|blue|green|purple)\b/ig); | |
if (colours == null) { return } | |
//console.log("colours:" + colours); | |
var pattern = []; | |
colours.forEach(function(colour) { | |
var cc = (colour == "RED") ? "P" : colour.charAt(0); |