node-red-contrib-homekit-bridged 2.0.0-dev.1 → 2.0.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/build/lib/HAPHostNode.js +59 -62
  2. package/build/lib/HAPServiceNode.js +89 -93
  3. package/build/lib/HAPServiceNode2.js +91 -95
  4. package/build/lib/Storage.d.ts +3 -3
  5. package/build/lib/Storage.js +2 -2
  6. package/build/lib/api.js +9 -11
  7. package/build/lib/hap/HAPCharacteristic.d.ts +1 -1
  8. package/build/lib/hap/HAPService.d.ts +1 -1
  9. package/build/lib/hap/eve-app/EveCharacteristics.d.ts +1 -1
  10. package/build/lib/types/CustomCharacteristicType.d.ts +1 -1
  11. package/build/lib/types/HAPHostConfigType.d.ts +4 -4
  12. package/build/lib/types/HAPHostNodeType.d.ts +4 -4
  13. package/build/lib/types/HAPService2ConfigType.d.ts +2 -2
  14. package/build/lib/types/HAPService2NodeType.d.ts +3 -3
  15. package/build/lib/types/HAPServiceConfigType.d.ts +3 -3
  16. package/build/lib/types/HAPServiceNodeType.d.ts +10 -10
  17. package/build/lib/types/HAPStatusConfigType.d.ts +1 -1
  18. package/build/lib/types/HAPStatusNodeType.d.ts +5 -5
  19. package/build/lib/types/NodeType.d.ts +1 -1
  20. package/build/lib/types/storage/SerializedHostType.d.ts +2 -2
  21. package/build/lib/utils/AccessoryUtils.js +8 -10
  22. package/build/lib/utils/BridgeUtils.js +4 -4
  23. package/build/lib/utils/CharacteristicUtils.js +5 -5
  24. package/build/lib/utils/CharacteristicUtils2.js +5 -5
  25. package/build/lib/utils/NodeStatusUtils.d.ts +2 -2
  26. package/build/lib/utils/NodeStatusUtils.js +2 -2
  27. package/build/lib/utils/ServiceUtils.js +24 -20
  28. package/build/lib/utils/ServiceUtils2.js +28 -25
  29. package/build/lib/utils/index.js +1 -1
  30. package/build/nodes/nrchkb.js +2 -2
  31. package/build/nodes/status.js +12 -13
  32. package/package.json +3 -2
@@ -17,17 +17,16 @@ const logger_1 = require("@nrchkb/logger");
17
17
  const semver_1 = require("semver");
18
18
  const preload_1 = __importDefault(require("semver/preload"));
19
19
  const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
20
- const HapCategories_1 = __importDefault(require("./types/hap-nodejs/HapCategories"));
21
20
  const HostType_1 = __importDefault(require("./types/HostType"));
21
+ const HapCategories_1 = __importDefault(require("./types/hap-nodejs/HapCategories"));
22
22
  module.exports = (RED, hostType) => {
23
23
  const init = function (config) {
24
24
  var _a, _b, _c;
25
- const self = this;
26
- const log = (0, logger_1.logger)('NRCHKB', 'HAPHostNode', config.bridgeName, self);
27
- self.hostType = hostType;
28
- RED.nodes.createNode(self, config);
29
- self.config = config;
30
- self.name = config.bridgeName;
25
+ const log = (0, logger_1.logger)('NRCHKB', 'HAPHostNode', config.bridgeName, this);
26
+ this.hostType = hostType;
27
+ RED.nodes.createNode(this, config);
28
+ this.config = config;
29
+ this.name = config.bridgeName;
31
30
  if (!hostNameValidator(config.bridgeName)) {
32
31
  log.error('Host name is incorrect', false);
33
32
  return new NRCHKBError_1.default('Host name is incorrect');
@@ -35,79 +34,79 @@ module.exports = (RED, hostType) => {
35
34
  if (preload_1.default.parse(config.firmwareRev) == null) {
36
35
  config.firmwareRev = new semver_1.SemVer('0.0.0');
37
36
  }
38
- self.accessoryCategory = (self.hostType == HostType_1.default.BRIDGE
37
+ this.accessoryCategory = (this.hostType == HostType_1.default.BRIDGE
39
38
  ? HapCategories_1.default.BRIDGE
40
- : self.config.accessoryCategory);
41
- self.published = false;
39
+ : this.config.accessoryCategory);
40
+ this.published = false;
42
41
  try {
43
- self.bridgeUsername = macify(self.id);
42
+ this.bridgeUsername = macify(this.id);
44
43
  }
45
44
  catch (error) {
46
45
  log.error(error);
47
46
  return error;
48
47
  }
49
- const hostUUID = hap_nodejs_1.uuid.generate(self.id);
50
- const hostTypeName = self.hostType == HostType_1.default.BRIDGE ? 'Bridge' : 'Standalone Accessory';
48
+ const hostUUID = hap_nodejs_1.uuid.generate(this.id);
49
+ const hostTypeName = this.hostType == HostType_1.default.BRIDGE ? 'Bridge' : 'Standalone Accessory';
51
50
  log.debug(`Creating ${hostTypeName} with UUID ${hostUUID}`);
52
- if (self.hostType == HostType_1.default.BRIDGE) {
53
- self.host = new hap_nodejs_1.Bridge(self.name, hostUUID);
51
+ if (this.hostType == HostType_1.default.BRIDGE) {
52
+ this.host = new hap_nodejs_1.Bridge(this.name, hostUUID);
54
53
  }
55
54
  else {
56
- self.host = new hap_nodejs_1.Accessory(self.name, hostUUID);
55
+ this.host = new hap_nodejs_1.Accessory(this.name, hostUUID);
57
56
  }
58
- self.publish = function () {
57
+ this.publish = () => {
59
58
  var _a, _b;
60
- if (self.hostType == HostType_1.default.BRIDGE) {
61
- log.debug(`Publishing ${hostTypeName} with pin code ${self.config.pinCode} and ${self.host.bridgedAccessories.length} accessories`);
59
+ if (this.hostType == HostType_1.default.BRIDGE) {
60
+ log.debug(`Publishing ${hostTypeName} with pin code ${this.config.pinCode} and ${this.host.bridgedAccessories.length} accessories`);
62
61
  }
63
62
  else {
64
- log.debug(`Publishing ${hostTypeName} with pin code ${self.config.pinCode}`);
63
+ log.debug(`Publishing ${hostTypeName} with pin code ${this.config.pinCode}`);
65
64
  }
66
- if (self.config.port && self.config.port == 1880) {
65
+ if (this.config.port === 1880) {
67
66
  log.error(`Cannot publish on ${hostTypeName} port 1880 as it is reserved for node-red`);
68
- self.published = false;
67
+ this.published = false;
69
68
  return false;
70
69
  }
71
- let oldPinCode = self.config.pinCode;
72
- if ((oldPinCode.match(/-/g) || []).length == 1) {
70
+ let oldPinCode = this.config.pinCode;
71
+ if ((oldPinCode.match(/-/g) || []).length === 1) {
73
72
  oldPinCode = oldPinCode.replace(/-/g, '');
74
73
  oldPinCode = `${oldPinCode.slice(0, 3)}-${oldPinCode.slice(3, 5)}-${oldPinCode.slice(5, 8)}`;
75
74
  }
76
75
  let bind;
77
- if (((_a = self.config.bind) === null || _a === void 0 ? void 0 : _a.length) && self.config.bindType) {
78
- if (self.config.bindType == 'str') {
79
- bind = self.config.bind;
76
+ if (((_a = this.config.bind) === null || _a === void 0 ? void 0 : _a.length) && this.config.bindType) {
77
+ if (this.config.bindType === 'str') {
78
+ bind = this.config.bind;
80
79
  }
81
- else if (self.config.bindType == 'json') {
82
- bind = JSON.parse(self.config.bind);
80
+ else if (this.config.bindType === 'json') {
81
+ bind = JSON.parse(this.config.bind);
83
82
  }
84
83
  }
85
- self.host.publish({
86
- username: self.bridgeUsername,
87
- port: self.config.port && !isNaN(self.config.port) ? self.config.port : 0,
84
+ this.host.publish({
85
+ username: this.bridgeUsername,
86
+ port: this.config.port && !Number.isNaN(this.config.port)
87
+ ? this.config.port
88
+ : 0,
88
89
  pincode: oldPinCode,
89
- category: self.accessoryCategory,
90
+ category: this.accessoryCategory,
90
91
  bind: bind,
91
- advertiser: (_b = self.config.advertiser) !== null && _b !== void 0 ? _b : "bonjour-hap"
92
- }, self.config.allowInsecureRequest);
93
- self.published = true;
92
+ advertiser: (_b = this.config.advertiser) !== null && _b !== void 0 ? _b : "bonjour-hap"
93
+ }, this.config.allowInsecureRequest);
94
+ this.published = true;
94
95
  return true;
95
96
  };
96
- self.on('close', function (removed, done) {
97
- return __awaiter(this, void 0, void 0, function* () {
98
- if (removed) {
99
- log.debug('This node has been deleted');
100
- yield self.host.destroy();
101
- }
102
- else {
103
- log.debug('This node is being restarted');
104
- yield self.host.unpublish();
105
- }
106
- self.published = false;
107
- done();
108
- });
109
- });
110
- self.host.on('identify', function (paired, callback) {
97
+ this.on('close', (removed, done) => __awaiter(this, void 0, void 0, function* () {
98
+ if (removed) {
99
+ log.debug('This node has been deleted');
100
+ yield this.host.destroy();
101
+ }
102
+ else {
103
+ log.debug('This node is being restarted');
104
+ yield this.host.unpublish();
105
+ }
106
+ this.published = false;
107
+ done();
108
+ }));
109
+ this.host.on('identify', (paired, callback) => {
111
110
  if (paired) {
112
111
  log.debug(`Identify called on paired ${hostTypeName}`);
113
112
  }
@@ -116,15 +115,15 @@ module.exports = (RED, hostType) => {
116
115
  }
117
116
  callback();
118
117
  });
119
- const accessoryInformationService = self.host.getService(hap_nodejs_1.Service.AccessoryInformation) ||
120
- self.host.addService(hap_nodejs_1.Service.AccessoryInformation);
118
+ const accessoryInformationService = this.host.getService(hap_nodejs_1.Service.AccessoryInformation) ||
119
+ this.host.addService(hap_nodejs_1.Service.AccessoryInformation);
121
120
  accessoryInformationService
122
- .setCharacteristic(hap_nodejs_1.Characteristic.Manufacturer, self.config.manufacturer)
123
- .setCharacteristic(hap_nodejs_1.Characteristic.SerialNumber, self.config.serialNo)
124
- .setCharacteristic(hap_nodejs_1.Characteristic.Model, self.config.model)
125
- .setCharacteristic(hap_nodejs_1.Characteristic.FirmwareRevision, (_a = self.config.firmwareRev) === null || _a === void 0 ? void 0 : _a.toString())
126
- .setCharacteristic(hap_nodejs_1.Characteristic.HardwareRevision, (_b = self.config.hardwareRev) === null || _b === void 0 ? void 0 : _b.toString())
127
- .setCharacteristic(hap_nodejs_1.Characteristic.SoftwareRevision, (_c = self.config.softwareRev) === null || _c === void 0 ? void 0 : _c.toString());
121
+ .setCharacteristic(hap_nodejs_1.Characteristic.Manufacturer, this.config.manufacturer)
122
+ .setCharacteristic(hap_nodejs_1.Characteristic.SerialNumber, this.config.serialNo)
123
+ .setCharacteristic(hap_nodejs_1.Characteristic.Model, this.config.model)
124
+ .setCharacteristic(hap_nodejs_1.Characteristic.FirmwareRevision, (_a = this.config.firmwareRev) === null || _a === void 0 ? void 0 : _a.toString())
125
+ .setCharacteristic(hap_nodejs_1.Characteristic.HardwareRevision, (_b = this.config.hardwareRev) === null || _b === void 0 ? void 0 : _b.toString())
126
+ .setCharacteristic(hap_nodejs_1.Characteristic.SoftwareRevision, (_c = this.config.softwareRev) === null || _c === void 0 ? void 0 : _c.toString());
128
127
  };
129
128
  const macify = (nodeId) => {
130
129
  if (nodeId) {
@@ -142,9 +141,7 @@ module.exports = (RED, hostType) => {
142
141
  throw new NRCHKBError_1.default('nodeId cannot be empty in macify process');
143
142
  }
144
143
  };
145
- const hostNameValidator = function (hostName) {
146
- return hostName ? /^[^.]{1,64}$/.test(hostName) : false;
147
- };
144
+ const hostNameValidator = (hostName) => hostName ? /^[^.]{1,64}$/.test(hostName) : false;
148
145
  return {
149
146
  init,
150
147
  macify
@@ -10,69 +10,66 @@ const HostType_1 = __importDefault(require("./types/HostType"));
10
10
  const NodeStatusUtils_1 = require("./utils/NodeStatusUtils");
11
11
  module.exports = (RED) => {
12
12
  const nrchkbConfigCompatibilityOverride = function () {
13
- const self = this;
14
- const log = (0, logger_1.logger)('NRCHKB', 'HAPServiceNode', self.config.name, self);
15
- if (self.config.isParent === undefined) {
16
- log.trace(`nrchkbConfigCompatibilityOverride => self.config.isParent=${self.config.isParent} value changed to true`);
17
- self.config.isParent = true;
13
+ const log = (0, logger_1.logger)('NRCHKB', 'HAPServiceNode', this.config.name, this);
14
+ if (this.config.isParent === undefined) {
15
+ log.trace(`nrchkbConfigCompatibilityOverride => self.config.isParent=${this.config.isParent} value changed to true`);
16
+ this.config.isParent = true;
18
17
  }
19
- if (self.config.hostType === undefined) {
20
- log.trace(`nrchkbConfigCompatibilityOverride => self.config.hostType=${self.config.hostType} value changed to HostType.BRIDGE`);
21
- self.config.hostType = HostType_1.default.BRIDGE;
18
+ if (this.config.hostType === undefined) {
19
+ log.trace(`nrchkbConfigCompatibilityOverride => self.config.hostType=${this.config.hostType} value changed to HostType.BRIDGE`);
20
+ this.config.hostType = HostType_1.default.BRIDGE;
22
21
  }
23
22
  };
24
23
  const preInit = function (config) {
25
- const self = this;
26
- self.nodeStatusUtils = new NodeStatusUtils_1.NodeStatusUtils(self);
27
- self.config = config;
28
- self.name = self.config.name;
29
- const log = (0, logger_1.logger)('NRCHKB', 'HAPServiceNode', self.config.name, self);
30
- self.RED = RED;
31
- self.publishTimers = {};
32
- nrchkbConfigCompatibilityOverride.call(self);
33
- RED.nodes.createNode(self, self.config);
34
- const ServiceUtils = require('./utils/ServiceUtils')(self);
24
+ this.nodeStatusUtils = new NodeStatusUtils_1.NodeStatusUtils(this);
25
+ this.config = config;
26
+ this.name = this.config.name;
27
+ const log = (0, logger_1.logger)('NRCHKB', 'HAPServiceNode', this.config.name, this);
28
+ this.RED = RED;
29
+ this.publishTimers = {};
30
+ nrchkbConfigCompatibilityOverride.call(this);
31
+ RED.nodes.createNode(this, this.config);
32
+ const ServiceUtils = require('./utils/ServiceUtils')(this);
35
33
  new Promise((resolve) => {
36
- if (self.config.waitForSetupMsg) {
34
+ if (this.config.waitForSetupMsg) {
37
35
  log.debug('Waiting for Setup message. It should be of format {"payload":{"nrchkb":{"setup":{}}}}');
38
- self.setupDone = false;
39
- self.nodeStatusUtils.setStatus({
36
+ this.setupDone = false;
37
+ this.nodeStatusUtils.setStatus({
40
38
  fill: 'blue',
41
39
  shape: 'dot',
42
40
  text: 'Waiting for Setup'
43
41
  });
44
- self.handleWaitForSetup = (msg) => ServiceUtils.handleWaitForSetup(self.config, msg, resolve);
45
- self.on('input', self.handleWaitForSetup);
42
+ this.handleWaitForSetup = (msg) => ServiceUtils.handleWaitForSetup(this.config, msg, resolve);
43
+ this.on('input', this.handleWaitForSetup);
46
44
  }
47
45
  else {
48
- resolve(self.config);
46
+ resolve(this.config);
49
47
  }
50
48
  })
51
49
  .then((newConfig) => {
52
- init.call(self, newConfig);
50
+ init.call(this, newConfig);
53
51
  })
54
52
  .catch((error) => {
55
53
  log.error(`Error while starting Service due to ${error}`);
56
54
  });
57
55
  };
58
56
  const init = function (config) {
59
- const self = this;
60
- self.config = config;
61
- const log = (0, logger_1.logger)('NRCHKB', 'HAPServiceNode', self.config.name, self);
62
- const ServiceUtils = require('./utils/ServiceUtils')(self);
63
- if (self.config.isParent) {
57
+ this.config = config;
58
+ const log = (0, logger_1.logger)('NRCHKB', 'HAPServiceNode', this.config.name, this);
59
+ const ServiceUtils = require('./utils/ServiceUtils')(this);
60
+ if (this.config.isParent) {
64
61
  log.debug('Starting Parent Service');
65
- configure.call(self);
66
- self.configured = true;
67
- self.reachable = true;
62
+ configure.call(this);
63
+ this.configured = true;
64
+ this.reachable = true;
68
65
  }
69
66
  else {
70
67
  const serviceType = config.serviceName === 'CameraControl' ? 'Camera' : 'Linked';
71
68
  ServiceUtils.waitForParent()
72
69
  .then(() => {
73
70
  log.debug(`Starting ${serviceType} Service`);
74
- configure.call(self);
75
- self.configured = true;
71
+ configure.call(this);
72
+ this.configured = true;
76
73
  })
77
74
  .catch((error) => {
78
75
  log.error(`Error while starting ${serviceType} Service due to ${error}`);
@@ -81,99 +78,98 @@ module.exports = (RED) => {
81
78
  };
82
79
  const configure = function () {
83
80
  var _a, _b;
84
- const self = this;
85
- const log = (0, logger_1.logger)('NRCHKB', 'HAPServiceNode', self.config.name, self);
86
- const Utils = require('./utils')(self);
81
+ const log = (0, logger_1.logger)('NRCHKB', 'HAPServiceNode', this.config.name, this);
82
+ const Utils = require('./utils')(this);
87
83
  const AccessoryUtils = Utils.AccessoryUtils;
88
84
  const BridgeUtils = Utils.BridgeUtils;
89
85
  const CharacteristicUtils = Utils.CharacteristicUtils;
90
86
  const ServiceUtils = Utils.ServiceUtils;
91
87
  let parentNode;
92
- if (self.config.isParent) {
93
- const hostId = self.config.hostType == HostType_1.default.BRIDGE
94
- ? self.config.bridge
95
- : self.config.accessoryId;
96
- self.hostNode = RED.nodes.getNode(hostId);
97
- if (!self.hostNode) {
98
- const message = `Host node ${self.config.hostType == HostType_1.default.BRIDGE ? 'Bridge' : 'Standalone Accessory'} ${hostId} not found`;
88
+ if (this.config.isParent) {
89
+ const hostId = this.config.hostType == HostType_1.default.BRIDGE
90
+ ? this.config.bridge
91
+ : this.config.accessoryId;
92
+ this.hostNode = RED.nodes.getNode(hostId);
93
+ if (!this.hostNode) {
94
+ const message = `Host node ${this.config.hostType == HostType_1.default.BRIDGE ? 'Bridge' : 'Standalone Accessory'} ${hostId} not found`;
99
95
  log.error(message, false);
100
96
  throw new NRCHKBError_1.default(message);
101
97
  }
102
- self.childNodes = [];
103
- self.childNodes.push(self);
98
+ this.childNodes = [];
99
+ this.childNodes.push(this);
104
100
  }
105
101
  else {
106
- parentNode = RED.nodes.getNode(self.config.parentService);
102
+ parentNode = RED.nodes.getNode(this.config.parentService);
107
103
  if (!parentNode) {
108
104
  log.error('Parent Node not assigned', false);
109
105
  throw new NRCHKBError_1.default('Parent Node not assigned');
110
106
  }
111
- self.parentNode = parentNode;
112
- self.parentService = self.parentNode.service;
113
- if (!self.parentService) {
107
+ this.parentNode = parentNode;
108
+ this.parentService = this.parentNode.service;
109
+ if (!this.parentService) {
114
110
  log.error('Parent Service not assigned', false);
115
111
  throw new NRCHKBError_1.default('Parent Service not assigned');
116
112
  }
117
- self.hostNode = self.parentNode.hostNode;
118
- (_a = self.parentNode.childNodes) === null || _a === void 0 ? void 0 : _a.push(self);
119
- self.accessory = self.parentNode.accessory;
113
+ this.hostNode = this.parentNode.hostNode;
114
+ (_a = this.parentNode.childNodes) === null || _a === void 0 ? void 0 : _a.push(this);
115
+ this.accessory = this.parentNode.accessory;
120
116
  }
121
- self.name = self.config.name;
122
- if (self.hasOwnProperty('_flow') &&
123
- self.hasOwnProperty('_alias') &&
124
- ((_b = self._flow) === null || _b === void 0 ? void 0 : _b.hasOwnProperty('TYPE')) &&
125
- self._flow.TYPE === 'subflow') {
126
- self.uniqueIdentifier = self._alias + '/' + self._flow.path;
117
+ this.name = this.config.name;
118
+ if (Object.hasOwn(this, '_flow') &&
119
+ Object.hasOwn(this, '_alias') &&
120
+ (this._flow ? Object(this._flow).hasOwn('TYPE') : false) &&
121
+ ((_b = this._flow) === null || _b === void 0 ? void 0 : _b.TYPE) === 'subflow') {
122
+ this.uniqueIdentifier = `${this._alias}/${this._flow.path}`;
127
123
  }
128
124
  else {
129
- self.uniqueIdentifier = self.id;
125
+ this.uniqueIdentifier = this.id;
130
126
  }
131
- const subtypeUUID = hap_nodejs_1.uuid.generate(self.uniqueIdentifier);
132
- if (self.config.hostType == HostType_1.default.BRIDGE) {
133
- if (self.config.isParent) {
127
+ const subtypeUUID = hap_nodejs_1.uuid.generate(this.uniqueIdentifier);
128
+ if (this.config.hostType == HostType_1.default.BRIDGE) {
129
+ if (this.config.isParent) {
134
130
  const accessoryUUID = hap_nodejs_1.uuid.generate('A' +
135
- self.uniqueIdentifier +
136
- self.name +
137
- self.config.manufacturer +
138
- self.config.serialNo +
139
- self.config.model);
140
- self.accessory = AccessoryUtils.getOrCreate(self.hostNode.host, {
141
- name: self.name,
131
+ this.uniqueIdentifier +
132
+ this.name +
133
+ this.config.manufacturer +
134
+ this.config.serialNo +
135
+ this.config.model);
136
+ this.accessory = AccessoryUtils.getOrCreate(this.hostNode.host, {
137
+ name: this.name,
142
138
  UUID: accessoryUUID,
143
- manufacturer: self.config.manufacturer,
144
- serialNo: self.config.serialNo,
145
- model: self.config.model,
146
- firmwareRev: self.config.firmwareRev,
147
- hardwareRev: self.config.hardwareRev,
148
- softwareRev: self.config.softwareRev
139
+ manufacturer: this.config.manufacturer,
140
+ serialNo: this.config.serialNo,
141
+ model: this.config.model,
142
+ firmwareRev: this.config.firmwareRev,
143
+ hardwareRev: this.config.hardwareRev,
144
+ softwareRev: this.config.softwareRev
149
145
  }, subtypeUUID);
150
- self.onIdentify = AccessoryUtils.onIdentify;
151
- self.accessory.on('identify', self.onIdentify);
146
+ this.onIdentify = AccessoryUtils.onIdentify;
147
+ this.accessory.on('identify', this.onIdentify);
152
148
  }
153
149
  }
154
150
  else {
155
151
  log.debug('Binding Service accessory as Standalone Accessory');
156
- self.accessory = self.hostNode.host;
152
+ this.accessory = this.hostNode.host;
157
153
  }
158
- self.service = ServiceUtils.getOrCreate(self.accessory, {
159
- name: self.name,
154
+ this.service = ServiceUtils.getOrCreate(this.accessory, {
155
+ name: this.name,
160
156
  UUID: subtypeUUID,
161
- serviceName: self.config.serviceName,
162
- config: self.config
163
- }, self.parentService);
164
- self.characteristicProperties = CharacteristicUtils.load(self.service, self.config);
157
+ serviceName: this.config.serviceName,
158
+ config: this.config
159
+ }, this.parentService);
160
+ this.characteristicProperties = CharacteristicUtils.load(this.service, this.config);
165
161
  ServiceUtils.configureAdaptiveLightning();
166
- if (self.config.isParent) {
167
- BridgeUtils.delayedPublish(self);
162
+ if (this.config.isParent) {
163
+ BridgeUtils.delayedPublish(this);
168
164
  }
169
- self.nodeStatusUtils.setStatus({
165
+ this.nodeStatusUtils.setStatus({
170
166
  fill: 'yellow',
171
167
  shape: 'ring',
172
- text: self.hostNode.config.pinCode
168
+ text: this.hostNode.config.pinCode
173
169
  });
174
- self.supported = CharacteristicUtils.subscribeAndGetSupported(self.service);
175
- self.on('input', ServiceUtils.onInput);
176
- self.on('close', ServiceUtils.onClose);
170
+ this.supported = CharacteristicUtils.subscribeAndGetSupported(this.service);
171
+ this.on('input', ServiceUtils.onInput);
172
+ this.on('close', ServiceUtils.onClose);
177
173
  };
178
174
  return {
179
175
  preInit,