homebridge-syntex-dynamic-platform
Advanced tools
Comparing version 1.0.0-b2 to 1.0.0-b3
module.exports = class BaseService | ||
{ | ||
constructor(homebridgeAccessory, deviceConfig, serviceType, type, subtype, manager) | ||
constructor(homebridgeAccessory, deviceConfig, serviceConfig, serviceType, manager) | ||
{ | ||
var service = homebridgeAccessory.getServiceById(serviceType, subtype); | ||
this.id = deviceConfig.id; | ||
this.name = serviceConfig.name; | ||
var service = homebridgeAccessory.getServiceById(serviceType, serviceConfig.subtype); | ||
if(service) | ||
{ | ||
manager.logger.debug('Existierenden Service gefunden! ' + deviceConfig.name + ' ' + type + ' ' + subtype + ' ( ' + deviceConfig.id + ' )'); | ||
manager.logger.debug('Existierenden Service gefunden! ' + serviceConfig.name + ' ' + serviceConfig.type + ' ' + serviceConfig.subtype + ' ( ' + this.id + ' )'); | ||
service.setCharacteristic(manager.platform.api.hap.Characteristic.Name, deviceConfig.name); | ||
service.setCharacteristic(manager.platform.api.hap.Characteristic.Name, serviceConfig.name); | ||
} | ||
else | ||
{ | ||
manager.logger.debug('Erstelle neuen Service! ' + deviceConfig.name + ' ' + type + ' ' + subtype + ' ( ' + deviceConfig.id + ' )'); | ||
manager.logger.debug('Erstelle neuen Service! ' + serviceConfig.name + ' ' + serviceConfig.type + ' ' + serviceConfig.subtype + ' ( ' + this.id + ' )'); | ||
homebridgeAccessory.addService(serviceType, deviceConfig.name, subtype) | ||
homebridgeAccessory.addService(serviceType, serviceConfig.name, serviceConfig.subtype) | ||
//homebridgeAccessory.service.push(); | ||
@@ -19,0 +22,0 @@ } |
@@ -8,3 +8,3 @@ const BaseService = require('./base'); | ||
{ | ||
constructor(homebridgeAccessory, deviceConfig, subtype, manager) | ||
constructor(homebridgeAccessory, deviceConfig, serviceConfig, manager) | ||
{ | ||
@@ -14,7 +14,7 @@ Service = manager.platform.api.hap.Service; | ||
super(homebridgeAccessory, deviceConfig, Service.Lightbulb, 'led', subtype, manager); | ||
super(homebridgeAccessory, deviceConfig, serviceConfig, Service.Lightbulb, manager); | ||
this.letters = '3' + subtype; | ||
this.letters = '3' + serviceConfig.subtype; | ||
homebridgeAccessory.getServiceById(Service.Lightbulb, subtype).getCharacteristic(Characteristic.On).on('get', this.getState.bind(this)).on('set', this.setState.bind(this)); | ||
homebridgeAccessory.getServiceById(Service.Lightbulb, serviceConfig.subtype).getCharacteristic(Characteristic.On).on('get', this.getState.bind(this)).on('set', this.setState.bind(this)); | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -8,3 +8,3 @@ const BaseService = require('./base'); | ||
{ | ||
constructor(homebridgeAccessory, deviceConfig, subtype, manager) | ||
constructor(homebridgeAccessory, deviceConfig, serviceConfig, manager) | ||
{ | ||
@@ -14,7 +14,7 @@ Service = manager.platform.api.hap.Service; | ||
super(homebridgeAccessory, deviceConfig, Service.Outlet, 'outlet', subtype, manager); | ||
super(homebridgeAccessory, deviceConfig, serviceConfig, Service.Outlet, manager); | ||
this.letters = '7' + subtype; | ||
this.letters = '7' + serviceConfig.subtype; | ||
homebridgeAccessory.getServiceById(Service.Outlet, subtype).getCharacteristic(Characteristic.On).on('get', this.getState.bind(this)).on('set', this.setState.bind(this)); | ||
homebridgeAccessory.getServiceById(Service.Outlet, serviceConfig.subtype).getCharacteristic(Characteristic.On).on('get', this.getState.bind(this)).on('set', this.setState.bind(this)); | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -8,3 +8,3 @@ const BaseService = require('./base'); | ||
{ | ||
constructor(homebridgeAccessory, deviceConfig, subtype, manager) | ||
constructor(homebridgeAccessory, deviceConfig, serviceConfig, manager) | ||
{ | ||
@@ -14,7 +14,7 @@ Service = manager.platform.api.hap.Service; | ||
super(homebridgeAccessory, deviceConfig, Service.Switch, 'switch', subtype, manager); | ||
super(homebridgeAccessory, deviceConfig, serviceConfig, Service.Switch, manager); | ||
this.letters = '4' + subtype; | ||
this.letters = '4' + serviceConfig.subtype; | ||
homebridgeAccessory.getServiceById(Service.Switch, subtype).getCharacteristic(Characteristic.On).on('get', this.getState.bind(this)).on('set', this.setState.bind(this)); | ||
homebridgeAccessory.getServiceById(Service.Switch, serviceConfig.subtype).getCharacteristic(Characteristic.On).on('get', this.getState.bind(this)).on('set', this.setState.bind(this)); | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -84,3 +84,3 @@ const OutletService = require('./outlet'); | ||
{ | ||
//var name = this.name; | ||
var name = this.name; | ||
var type = config; | ||
@@ -90,3 +90,2 @@ | ||
{ | ||
/* | ||
if(config.name != null) | ||
@@ -96,3 +95,3 @@ { | ||
} | ||
*/ | ||
if(config.type != null) | ||
@@ -106,11 +105,11 @@ { | ||
{ | ||
var service = new SwitchService(this.homebridgeAccessory, this.deviceConfig, subtype, this.manager); | ||
var service = new SwitchService(this.homebridgeAccessory, this.deviceConfig, { name : name, type : type, subtype : subtype }, this.manager); | ||
} | ||
else if(type == 'outlet') | ||
{ | ||
var service = new OutletService(this.homebridgeAccessory, this.deviceConfig, subtype, this.manager); | ||
var service = new OutletService(this.homebridgeAccessory, this.deviceConfig, { name : name, type : type, subtype : subtype }, this.manager); | ||
} | ||
else if(type == 'rgb') | ||
{ | ||
var service = new LightBulbService(this.homebridgeAccessory, this.deviceConfig, subtype, this.manager); | ||
var service = new LightBulbService(this.homebridgeAccessory, this.deviceConfig, { name : name, type : type, subtype : subtype }, this.manager); | ||
} | ||
@@ -117,0 +116,0 @@ |
{ | ||
"name": "homebridge-syntex-dynamic-platform", | ||
"version": "1.0.0-b2", | ||
"version": "1.0.0-b3", | ||
"description": "A Dynamic Platform Accessory", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20789
0
37