Example #1
0
	constructor: function(options) {
		if (!options || !options.id) throw Error('Invalid Id!');
		this._name = options.name;
		this._id = options.id;
		this._coords = [];
		this._life = 'young';
		this._color = colorspaces.make_color('sRGB', [number.random(0,80)/100, number.random(0,80)/100, number.random(0,80)/100]).as('hex');
		this._score = 0;
		this._size = 0;
		logger.debug('new bike loaded', this._id);
	},
Example #2
0
function setColor(cluster, hex) {

  var color = colorspaces.make_color('hex', hex).as('CIExyY');

  var payload = Concentrate();
  payload.uint16le(Math.floor(color[0] * 0xFFFF)); // Color X
  payload.uint16le(Math.floor(color[1] * 0xFFFF)); // Color Y
  payload.uint16le(3); // Transition duration (1/10th seconds)

  return cluster.commands['Move to Color'](payload.result());
}
Example #3
0
 }, function(err, cells){
   if(err){
     deferred.reject(err);
     return;
   } else {
     var color = colorspaces.make_color('hex',cells[22].value);
     var c = {
       name : cells[0].value,
       code : cells[1].value,
       special : cells[19].value,
       type : cells[20].value,
       hex : "#" + color.as('hex'),
       lab : color.as('CIELAB'),
       enabled : true
     };
     result.push(c);
     console.log(rowId + " : " + JSON.stringify(c));
     deferred.resolve(result);
   }
 });