Added serial

This commit is contained in:
Foxi352 2016-09-11 20:11:57 +02:00
parent 3ed830ecee
commit 3d868a5179

View File

@ -142,10 +142,12 @@ SmartHomeNGAccessory.prototype = {
} }
// construct service and characteristics according to device type // construct service and characteristics according to device type
var serial = "unknown";
switch (this.config.type.toLowerCase()) { switch (this.config.type.toLowerCase()) {
// Lightbulb service // Lightbulb service
case 'fan': case 'fan':
myServices.push(this.getFanService(this.config)); myServices.push(this.getFanService(this.config));
serial = this.config.onoff;
break; break;
case 'temperaturesensor': case 'temperaturesensor':
@ -158,6 +160,7 @@ SmartHomeNGAccessory.prototype = {
case 'lightbulb': case 'lightbulb':
myServices.push(this.getLightbulbService(this.config)); myServices.push(this.getLightbulbService(this.config));
serial = this.config.onoff;
break; break;
case 'windowcovering': case 'windowcovering':
@ -166,10 +169,12 @@ SmartHomeNGAccessory.prototype = {
case 'occupancysensor': case 'occupancysensor':
myServices.push(this.getOccupancySensorService(this.config)); myServices.push(this.getOccupancySensorService(this.config));
serial = this.config.motiondetected;
break; break;
case 'motionsensor': case 'motionsensor':
myServices.push(this.getMotionSensorService(this.config)); myServices.push(this.getMotionSensorService(this.config));
serial = this.config.motiondetected;
break; break;
// If no supported type is found warn user and return empty services // If no supported type is found warn user and return empty services
@ -184,7 +189,7 @@ SmartHomeNGAccessory.prototype = {
informationService informationService
.setCharacteristic(Characteristic.Manufacturer, "Opensource Community") .setCharacteristic(Characteristic.Manufacturer, "Opensource Community")
.setCharacteristic(Characteristic.Model, "SmartHomeNG device") .setCharacteristic(Characteristic.Model, "SmartHomeNG device")
.setCharacteristic(Characteristic.SerialNumber, "beta"); .setCharacteristic(Characteristic.SerialNumber, serial);
myServices.push(informationService); myServices.push(informationService);
return myServices; return myServices;