campusbadge-nodered
Advanced tools
Comparing version 0.0.1 to 0.0.2
71
badge.js
@@ -7,6 +7,4 @@ const mustache = require("mustache"); | ||
var node = this; | ||
this.badgeid = config.badgeid; | ||
this.lights = config.lights; | ||
this.tone = config.tone; | ||
this.time = config.time; | ||
this.tone = config.tone; | ||
this.time = config.time; | ||
this.led1 = config.led1; | ||
@@ -17,43 +15,40 @@ this.led2 = config.led2; | ||
this.led5 = config.led5; | ||
this.lights = config.lights; | ||
this.text = config.text; | ||
node.on('input', function(msg) { | ||
var data = dataobject(this.context(), msg) | ||
msg.payload = {} | ||
if (config.text != ''){ | ||
msg.payload.text = mustache.render(config.text, data) | ||
} | ||
if (this.time != ''){ | ||
msg.payload.sound = {} | ||
msg.payload.sound.tone = this.tone; | ||
msg.payload.sound.time = this.time; | ||
} | ||
if (this.lights != null){ | ||
msg.payload.lights = [] | ||
var data = dataobject(this.context(), msg) | ||
this.badgeid = mustache.render(config.badgeid, data) | ||
this.text = mustache.render(config.text, data) | ||
this.time = mustache.render(config.time, data) | ||
this.tone = mustache.render(config.tone, data) | ||
msg.payload = {} | ||
if (this.text != ''){ | ||
msg.payload.t = this.text | ||
} | ||
if (this.time != ''){ | ||
msg.payload.f = this.tone; | ||
msg.payload.d = this.time; | ||
} | ||
msg.payload.l = [] | ||
var d = hexToRgb(this.led1) | ||
msg.payload.lights.push(d.g) | ||
msg.payload.lights.push(d.r) | ||
msg.payload.lights.push(d.b) | ||
msg.payload.l.push(d.g) | ||
msg.payload.l.push(d.r) | ||
msg.payload.l.push(d.b) | ||
d = hexToRgb(this.led2) | ||
msg.payload.lights.push(d.g) | ||
msg.payload.lights.push(d.r) | ||
msg.payload.lights.push(d.b) | ||
msg.payload.l.push(d.g) | ||
msg.payload.l.push(d.r) | ||
msg.payload.l.push(d.b) | ||
d = hexToRgb(this.led3) | ||
msg.payload.lights.push(d.g) | ||
msg.payload.lights.push(d.r) | ||
msg.payload.lights.push(d.b) | ||
msg.payload.l.push(d.g) | ||
msg.payload.l.push(d.r) | ||
msg.payload.l.push(d.b) | ||
d = hexToRgb(this.led4) | ||
msg.payload.lights.push(d.g) | ||
msg.payload.lights.push(d.r) | ||
msg.payload.lights.push(d.b) | ||
msg.payload.l.push(d.g) | ||
msg.payload.l.push(d.r) | ||
msg.payload.l.push(d.b) | ||
d = hexToRgb(this.led5) | ||
msg.payload.lights.push(d.g) | ||
msg.payload.lights.push(d.r) | ||
msg.payload.lights.push(d.b) | ||
} | ||
console.log(msg.payload) | ||
clean(msg.payload) | ||
console.log(msg.payload) | ||
msg.topic = "/badge/"+this.badgeid+"/message" | ||
node.send(msg); | ||
msg.payload.l.push(d.g) | ||
msg.payload.l.push(d.r) | ||
msg.payload.l.push(d.b) | ||
msg.topic = "/badge/"+this.badgeid+"/message" | ||
node.send(msg); | ||
}); | ||
@@ -60,0 +55,0 @@ } |
{ | ||
"name": "campusbadge-nodered", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "NodeRED package for the Campus Badge", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
5329
4
1
7
83