Added Outlet

This commit is contained in:
Foxi352 2017-05-30 20:20:21 +02:00
parent 801d10c35e
commit 0155a5557e
3 changed files with 29 additions and 3 deletions

View File

@ -68,7 +68,7 @@ You have to create a config.json in .homebridge directory. You'll find that dire
"platform": "SmartHomeNG",
"name": "SmartHomeNG",
"host": "srvsmarthome.xxx.lu",
"host": "srvsmarthome.ha.swa.lu",
"accessories": [
{
"name": "Temperatur Stube",
@ -89,8 +89,13 @@ You have to create a config.json in .homebridge directory. You'll find that dire
"onoff": "OG.Bad.Ventilator"
},
{
"name": "Schaltsteckdose",
"name": "Schalter",
"type": "Switch",
"onoff": "EG.Esszimmer.Schalter"
},
{
"name": "Schaltsteckdose",
"type": "Outlet",
"onoff": "EG.Esszimmer.Steckdose"
},
{
@ -147,3 +152,4 @@ You have to create a config.json in .homebridge directory. You'll find that dire
"description": "This is my development config file."
}

View File

@ -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;
},
}

View File

@ -1,6 +1,6 @@
{
"name": "homebridge-smarthomeng",
"version": "1.3.6",
"version": "1.3.7",
"description": "Platform plugin for SmartHomeNG: https://github.com/smarthomeNG/smarthome",
"license": "GPL",
"keywords": [