Added Outlet
This commit is contained in:
1 parent
801d10c35e
commit
0155a5557e
3 files changed
+29
-3
No files matched your search
@@ -171,6 +171,10 @@ SmartHomeNGAccessory.prototype = {
|
||||
myServices.push(this.getSwitchService(this.config));
|
||||
break;
|
||||
|
||||
case 'outlet':
|
||||
myServices.push(this.getOutletService(this.config));
|
||||
break;
|
||||
|
||||
case 'windowcovering':
|
||||
myServices.push(this.getWindowCoveringService(this.config));
|
||||
break;
|
||||
@@ -629,4 +633,20 @@ SmartHomeNGAccessory.prototype = {
|
||||
return myService;
|
||||
},
|
||||
|
||||
// Create Outlet service
|
||||
getOutletService: function(config) {
|
||||
var myService = new Service.Outlet(config.name,config.name);
|
||||
var inverted = false;
|
||||
if (config.inverted) {
|
||||
inverted = true;
|
||||
}
|
||||
// On (and Off)
|
||||
if (config.onoff) {
|
||||
this.log("["+ this.name +"] Outlet on/off characteristic enabled");
|
||||
this.bindCharacteristic(myService, Characteristic.On, "Bool", config.onoff, inverted);
|
||||
}
|
||||
myService.getCharacteristic(Characteristic.OutletInUse).setValue(true);
|
||||
return myService;
|
||||
},
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user