node-red-contrib-homekit-bridged 2.0.0-dev.5 → 2.0.0-dev.7

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 (128) hide show
  1. package/build/lib/HAPHostNode.js +183 -141
  2. package/build/lib/HAPServiceNode.js +199 -172
  3. package/build/lib/HAPServiceNode2.js +207 -172
  4. package/build/lib/NRCHKBError.js +23 -2
  5. package/build/lib/PairingQRCode.js +62 -0
  6. package/build/lib/Storage.js +157 -92
  7. package/build/lib/api.js +654 -288
  8. package/build/lib/camera/CameraControl.js +119 -84
  9. package/build/lib/camera/CameraDelegate.js +481 -404
  10. package/build/lib/camera/MP4StreamingServer.js +148 -139
  11. package/build/lib/hap/HAPCharacteristic.js +25 -4
  12. package/build/lib/hap/HAPService.js +25 -4
  13. package/build/lib/hap/eve-app/EveCharacteristics.js +124 -81
  14. package/build/lib/hap/eve-app/EveServices.js +50 -17
  15. package/build/lib/hap/hap-nodejs.js +32 -0
  16. package/build/lib/migration/HomeKitService2Migration.js +34 -0
  17. package/build/lib/migration/NodeMigration.js +75 -0
  18. package/build/lib/types/AccessoryInformationType.js +15 -1
  19. package/build/lib/types/CameraConfigType.js +15 -1
  20. package/build/lib/types/CustomCharacteristicType.js +15 -1
  21. package/build/lib/types/HAPHostConfigType.js +15 -1
  22. package/build/lib/types/HAPHostNodeType.js +15 -1
  23. package/build/lib/types/HAPService2ConfigType.js +15 -1
  24. package/build/lib/types/HAPService2NodeType.js +15 -1
  25. package/build/lib/types/HAPServiceConfigType.js +15 -1
  26. package/build/lib/types/HAPServiceNodeType.js +15 -1
  27. package/build/lib/types/HAPStatusConfigType.js +15 -1
  28. package/build/lib/types/HAPStatusNodeType.js +15 -1
  29. package/build/lib/types/HostType.js +28 -7
  30. package/build/lib/types/NodeType.js +15 -1
  31. package/build/lib/types/PublishTimersType.js +15 -1
  32. package/build/lib/types/UniFiControllerConfigType.js +16 -0
  33. package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.js +28 -7
  34. package/build/lib/types/hap-nodejs/HapCategories.js +64 -43
  35. package/build/lib/types/storage/SerializedHostType.js +15 -1
  36. package/build/lib/types/storage/StorageType.js +34 -10
  37. package/build/lib/unifi/ProtectDiscovery.js +80 -0
  38. package/build/lib/utils/AccessoryUtils.js +152 -110
  39. package/build/lib/utils/BridgeUtils.js +82 -39
  40. package/build/lib/utils/CharacteristicUtils.js +5 -49
  41. package/build/lib/utils/CharacteristicUtils2.js +5 -49
  42. package/build/lib/utils/CharacteristicUtilsBase.js +81 -0
  43. package/build/lib/utils/NodeStatusUtils.js +89 -40
  44. package/build/lib/utils/ServiceUtils.js +434 -375
  45. package/build/lib/utils/ServiceUtils2.js +514 -309
  46. package/build/lib/utils/index.js +10 -11
  47. package/build/nodes/bridge.html +184 -166
  48. package/build/nodes/bridge.js +27 -9
  49. package/build/nodes/locales/en-US/node-red-contrib-homekit-bridged.json +22 -0
  50. package/build/nodes/nrchkb.html +1601 -88
  51. package/build/nodes/nrchkb.js +66 -88
  52. package/build/nodes/plugin-instance.html +499 -0
  53. package/build/nodes/plugin-instance.js +46 -0
  54. package/build/nodes/service.html +517 -299
  55. package/build/nodes/service.js +5 -6
  56. package/build/nodes/service2.html +1683 -460
  57. package/build/nodes/service2.js +5 -8
  58. package/build/nodes/standalone.html +187 -174
  59. package/build/nodes/standalone.js +27 -9
  60. package/build/nodes/status.html +51 -18
  61. package/build/nodes/status.js +47 -40
  62. package/build/nodes/unifi-controller.html +92 -0
  63. package/build/nodes/unifi-controller.js +20 -0
  64. package/build/plugins/embedded/homebridge-camera-ffmpeg/index.js +479 -0
  65. package/build/plugins/embedded/homebridge-unifi-protect/index.js +521 -0
  66. package/build/plugins/embedded/index.js +58 -0
  67. package/build/plugins/nrchkb-homekit-plugins.js +17 -0
  68. package/build/plugins/registry/index.js +203 -0
  69. package/build/plugins/registry/types.js +16 -0
  70. package/build/scripts/migrate-homekit-service-flows.js +47 -0
  71. package/examples/demo/01 - ALL Demos single import.json +1885 -1885
  72. package/examples/demo/02 - Air Purifier.json +279 -279
  73. package/examples/demo/03 - Air Quality sensor with Battery.json +254 -254
  74. package/examples/demo/04 - Dimmable Bulb.json +172 -172
  75. package/examples/demo/05 - Color Bulb (HSV).json +195 -195
  76. package/examples/demo/06 - Fan (simple, 3 speeds).json +240 -240
  77. package/examples/demo/07 - Fan (with speed, oscillate, rotation direction).json +175 -175
  78. package/examples/demo/08 - CO2 detector.json +224 -224
  79. package/examples/demo/09 - CO (carbon monoxide) example.json +255 -255
  80. package/examples/demo/10 - Door window contact sensor.json +234 -234
  81. package/examples/demos (advanced)/01 - Television with inputs and speaker.json +541 -541
  82. package/examples/switch/01 - Plain Switch.json +178 -178
  83. package/package.json +95 -84
  84. package/build/lib/HAPHostNode.d.ts +0 -1
  85. package/build/lib/HAPServiceNode.d.ts +0 -1
  86. package/build/lib/HAPServiceNode2.d.ts +0 -1
  87. package/build/lib/NRCHKBError.d.ts +0 -3
  88. package/build/lib/Storage.d.ts +0 -30
  89. package/build/lib/api.d.ts +0 -1
  90. package/build/lib/camera/CameraControl.d.ts +0 -3
  91. package/build/lib/camera/CameraDelegate.d.ts +0 -38
  92. package/build/lib/camera/MP4StreamingServer.d.ts +0 -26
  93. package/build/lib/hap/HAPCharacteristic.d.ts +0 -9
  94. package/build/lib/hap/HAPService.d.ts +0 -6
  95. package/build/lib/hap/eve-app/EveCharacteristics.d.ts +0 -20
  96. package/build/lib/hap/eve-app/EveServices.d.ts +0 -5
  97. package/build/lib/types/AccessoryInformationType.d.ts +0 -11
  98. package/build/lib/types/CameraConfigType.d.ts +0 -24
  99. package/build/lib/types/CustomCharacteristicType.d.ts +0 -6
  100. package/build/lib/types/HAPHostConfigType.d.ts +0 -22
  101. package/build/lib/types/HAPHostNodeType.d.ts +0 -14
  102. package/build/lib/types/HAPService2ConfigType.d.ts +0 -6
  103. package/build/lib/types/HAPService2NodeType.d.ts +0 -7
  104. package/build/lib/types/HAPServiceConfigType.d.ts +0 -26
  105. package/build/lib/types/HAPServiceNodeType.d.ts +0 -38
  106. package/build/lib/types/HAPStatusConfigType.d.ts +0 -5
  107. package/build/lib/types/HAPStatusNodeType.d.ts +0 -12
  108. package/build/lib/types/HostType.d.ts +0 -5
  109. package/build/lib/types/NodeType.d.ts +0 -3
  110. package/build/lib/types/PublishTimersType.d.ts +0 -4
  111. package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.d.ts +0 -5
  112. package/build/lib/types/hap-nodejs/HapCategories.d.ts +0 -41
  113. package/build/lib/types/storage/SerializedHostType.d.ts +0 -5
  114. package/build/lib/types/storage/StorageType.d.ts +0 -8
  115. package/build/lib/utils/AccessoryUtils.d.ts +0 -1
  116. package/build/lib/utils/BridgeUtils.d.ts +0 -1
  117. package/build/lib/utils/CharacteristicUtils.d.ts +0 -1
  118. package/build/lib/utils/CharacteristicUtils2.d.ts +0 -1
  119. package/build/lib/utils/NodeStatusUtils.d.ts +0 -17
  120. package/build/lib/utils/ServiceUtils.d.ts +0 -1
  121. package/build/lib/utils/ServiceUtils2.d.ts +0 -1
  122. package/build/lib/utils/index.d.ts +0 -1
  123. package/build/nodes/bridge.d.ts +0 -1
  124. package/build/nodes/nrchkb.d.ts +0 -1
  125. package/build/nodes/service.d.ts +0 -1
  126. package/build/nodes/service2.d.ts +0 -1
  127. package/build/nodes/standalone.d.ts +0 -1
  128. package/build/nodes/status.d.ts +0 -1
@@ -1,178 +1,205 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
4
15
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const hap_nodejs_1 = require("@homebridge/hap-nodejs");
7
- const logger_1 = require("@nrchkb/logger");
8
- const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
9
- const HostType_1 = __importDefault(require("./types/HostType"));
10
- const NodeStatusUtils_1 = require("./utils/NodeStatusUtils");
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var import_hap_nodejs = require("@homebridge/hap-nodejs");
25
+ var import_logger = require("@nrchkb/logger");
26
+ var import_NRCHKBError = __toESM(require("./NRCHKBError"));
27
+ var import_HostType = __toESM(require("./types/HostType"));
28
+ var import_NodeStatusUtils = require("./utils/NodeStatusUtils");
29
+ const buildServiceUtils = require("./utils/ServiceUtils");
30
+ const buildAccessoryUtils = require("./utils/AccessoryUtils");
31
+ const buildCharacteristicUtils = require("./utils/CharacteristicUtils");
32
+ const buildBridgeUtils = require("./utils/BridgeUtils");
11
33
  module.exports = (RED) => {
12
- const nrchkbConfigCompatibilityOverride = function () {
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;
17
- }
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;
21
- }
22
- };
23
- const preInit = function (config) {
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);
33
- new Promise((resolve) => {
34
- if (this.config.waitForSetupMsg) {
35
- log.debug('Waiting for Setup message. It should be of format {"payload":{"nrchkb":{"setup":{}}}}');
36
- this.setupDone = false;
37
- this.nodeStatusUtils.setStatus({
38
- fill: 'blue',
39
- shape: 'dot',
40
- text: 'Waiting for Setup'
41
- });
42
- this.handleWaitForSetup = (msg) => ServiceUtils.handleWaitForSetup(this.config, msg, resolve);
43
- this.on('input', this.handleWaitForSetup);
44
- }
45
- else {
46
- resolve(this.config);
47
- }
48
- })
49
- .then((newConfig) => {
50
- init.call(this, newConfig);
51
- })
52
- .catch((error) => {
53
- log.error(`Error while starting Service due to ${error}`);
54
- });
55
- };
56
- const init = function (config) {
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) {
61
- log.debug('Starting Parent Service');
62
- configure.call(this);
63
- this.configured = true;
64
- this.reachable = true;
65
- }
66
- else {
67
- const serviceType = config.serviceName === 'CameraControl' ? 'Camera' : 'Linked';
68
- ServiceUtils.waitForParent()
69
- .then(() => {
70
- log.debug(`Starting ${serviceType} Service`);
71
- configure.call(this);
72
- this.configured = true;
73
- })
74
- .catch((error) => {
75
- log.error(`Error while starting ${serviceType} Service due to ${error}`);
76
- });
77
- }
78
- };
79
- const configure = function () {
80
- var _a, _b;
81
- const log = (0, logger_1.logger)('NRCHKB', 'HAPServiceNode', this.config.name, this);
82
- const Utils = require('./utils')(this);
83
- const AccessoryUtils = Utils.AccessoryUtils;
84
- const BridgeUtils = Utils.BridgeUtils;
85
- const CharacteristicUtils = Utils.CharacteristicUtils;
86
- const ServiceUtils = Utils.ServiceUtils;
87
- let parentNode;
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`;
95
- log.error(message, false);
96
- throw new NRCHKBError_1.default(message);
97
- }
98
- this.childNodes = [];
99
- this.childNodes.push(this);
100
- }
101
- else {
102
- parentNode = RED.nodes.getNode(this.config.parentService);
103
- if (!parentNode) {
104
- log.error('Parent Node not assigned', false);
105
- throw new NRCHKBError_1.default('Parent Node not assigned');
106
- }
107
- this.parentNode = parentNode;
108
- this.parentService = this.parentNode.service;
109
- if (!this.parentService) {
110
- log.error('Parent Service not assigned', false);
111
- throw new NRCHKBError_1.default('Parent Service not assigned');
112
- }
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;
116
- }
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}`;
123
- }
124
- else {
125
- this.uniqueIdentifier = this.id;
126
- }
127
- const subtypeUUID = hap_nodejs_1.uuid.generate(this.uniqueIdentifier);
128
- if (this.config.hostType == HostType_1.default.BRIDGE) {
129
- if (this.config.isParent) {
130
- const accessoryUUID = hap_nodejs_1.uuid.generate('A' +
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,
138
- UUID: accessoryUUID,
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
145
- }, subtypeUUID);
146
- this.onIdentify = AccessoryUtils.onIdentify;
147
- this.accessory.on('identify', this.onIdentify);
148
- }
149
- }
150
- else {
151
- log.debug('Binding Service accessory as Standalone Accessory');
152
- this.accessory = this.hostNode.host;
153
- }
154
- this.service = ServiceUtils.getOrCreate(this.accessory, {
155
- name: this.name,
156
- UUID: subtypeUUID,
157
- serviceName: this.config.serviceName,
158
- config: this.config
159
- }, this.parentService);
160
- this.characteristicProperties = CharacteristicUtils.load(this.service, this.config);
161
- ServiceUtils.configureAdaptiveLightning();
162
- if (this.config.isParent) {
163
- BridgeUtils.delayedPublish(this);
164
- }
34
+ const nrchkbConfigCompatibilityOverride = function() {
35
+ const log = (0, import_logger.logger)("NRCHKB", "HAPServiceNode", this.config.name, this);
36
+ if (this.config.isParent === void 0) {
37
+ log.trace(
38
+ `nrchkbConfigCompatibilityOverride => self.config.isParent=${this.config.isParent} value changed to true`
39
+ );
40
+ this.config.isParent = true;
41
+ }
42
+ if (this.config.hostType === void 0) {
43
+ log.trace(
44
+ `nrchkbConfigCompatibilityOverride => self.config.hostType=${this.config.hostType} value changed to HostType.BRIDGE`
45
+ );
46
+ this.config.hostType = import_HostType.default.BRIDGE;
47
+ }
48
+ };
49
+ const preInit = function(config) {
50
+ this.nodeStatusUtils = new import_NodeStatusUtils.NodeStatusUtils(this);
51
+ this.config = config;
52
+ this.name = this.config.name;
53
+ const log = (0, import_logger.logger)("NRCHKB", "HAPServiceNode", this.config.name, this);
54
+ this.RED = RED;
55
+ this.publishTimers = {};
56
+ nrchkbConfigCompatibilityOverride.call(this);
57
+ RED.nodes.createNode(this, this.config);
58
+ const ServiceUtils = buildServiceUtils(this);
59
+ new Promise((resolve) => {
60
+ if (this.config.waitForSetupMsg) {
61
+ log.debug(
62
+ 'Waiting for Setup message. It should be of format {"payload":{"nrchkb":{"setup":{}}}}'
63
+ );
64
+ this.setupDone = false;
165
65
  this.nodeStatusUtils.setStatus({
166
- fill: 'yellow',
167
- shape: 'ring',
168
- text: this.hostNode.config.pinCode
66
+ fill: "blue",
67
+ shape: "dot",
68
+ text: "Waiting for Setup"
169
69
  });
170
- this.supported = CharacteristicUtils.subscribeAndGetSupported(this.service);
171
- this.on('input', ServiceUtils.onInput);
172
- this.on('close', ServiceUtils.onClose);
173
- };
174
- return {
175
- preInit,
176
- init
177
- };
70
+ this.handleWaitForSetup = (msg) => ServiceUtils.handleWaitForSetup(this.config, msg, resolve);
71
+ this.on("input", this.handleWaitForSetup);
72
+ } else {
73
+ resolve(this.config);
74
+ }
75
+ }).then((newConfig) => {
76
+ init.call(this, newConfig);
77
+ }).catch((error) => {
78
+ log.error(`Error while starting Service due to ${error}`);
79
+ });
80
+ };
81
+ const init = function(config) {
82
+ this.config = config;
83
+ const log = (0, import_logger.logger)("NRCHKB", "HAPServiceNode", this.config.name, this);
84
+ const ServiceUtils = buildServiceUtils(this);
85
+ if (this.config.isParent) {
86
+ log.debug("Starting Parent Service");
87
+ configure.call(this);
88
+ this.configured = true;
89
+ this.reachable = true;
90
+ } else {
91
+ const serviceType = config.serviceName === "CameraControl" ? "Camera" : "Linked";
92
+ ServiceUtils.waitForParent().then(() => {
93
+ log.debug(`Starting ${serviceType} Service`);
94
+ configure.call(this);
95
+ this.configured = true;
96
+ }).catch((error) => {
97
+ log.error(
98
+ `Error while starting ${serviceType} Service due to ${error}`
99
+ );
100
+ });
101
+ }
102
+ };
103
+ const configure = function() {
104
+ const log = (0, import_logger.logger)("NRCHKB", "HAPServiceNode", this.config.name, this);
105
+ const ServiceUtils = buildServiceUtils(this);
106
+ const AccessoryUtils = buildAccessoryUtils(this);
107
+ const BridgeUtils = buildBridgeUtils();
108
+ const CharacteristicUtils = buildCharacteristicUtils(this);
109
+ let parentNode;
110
+ if (this.config.isParent) {
111
+ const hostId = this.config.hostType == import_HostType.default.BRIDGE ? this.config.bridge : this.config.accessoryId;
112
+ this.hostNode = RED.nodes.getNode(hostId);
113
+ if (!this.hostNode) {
114
+ const message = `Host node ${this.config.hostType == import_HostType.default.BRIDGE ? "Bridge" : "Standalone Accessory"} ${hostId} not found`;
115
+ log.error(message, false);
116
+ throw new import_NRCHKBError.default(message);
117
+ }
118
+ this.childNodes = [];
119
+ this.childNodes.push(this);
120
+ } else {
121
+ parentNode = RED.nodes.getNode(
122
+ this.config.parentService
123
+ );
124
+ if (!parentNode) {
125
+ log.error("Parent Node not assigned", false);
126
+ throw new import_NRCHKBError.default("Parent Node not assigned");
127
+ }
128
+ this.parentNode = parentNode;
129
+ this.parentService = this.parentNode.service;
130
+ if (!this.parentService) {
131
+ log.error("Parent Service not assigned", false);
132
+ throw new import_NRCHKBError.default("Parent Service not assigned");
133
+ }
134
+ this.hostNode = this.parentNode.hostNode;
135
+ this.parentNode.childNodes?.push(this);
136
+ this.accessory = this.parentNode.accessory;
137
+ }
138
+ this.name = this.config.name;
139
+ if (Object.hasOwn(this, "_flow") && Object.hasOwn(this, "_alias") && (this._flow ? Object(this._flow).hasOwn("TYPE") : false) && this._flow?.TYPE === "subflow") {
140
+ this.uniqueIdentifier = `${this._alias}/${this._flow.path}`;
141
+ } else {
142
+ this.uniqueIdentifier = this.id;
143
+ }
144
+ const subtypeUUID = import_hap_nodejs.uuid.generate(this.uniqueIdentifier);
145
+ if (this.config.hostType == import_HostType.default.BRIDGE) {
146
+ if (this.config.isParent) {
147
+ const accessoryUUID = import_hap_nodejs.uuid.generate(
148
+ "A" + this.uniqueIdentifier + this.name + this.config.manufacturer + this.config.serialNo + this.config.model
149
+ );
150
+ this.accessory = AccessoryUtils.getOrCreate(
151
+ this.hostNode.host,
152
+ {
153
+ name: this.name,
154
+ UUID: accessoryUUID,
155
+ manufacturer: this.config.manufacturer,
156
+ serialNo: this.config.serialNo,
157
+ model: this.config.model,
158
+ firmwareRev: this.config.firmwareRev,
159
+ hardwareRev: this.config.hardwareRev,
160
+ softwareRev: this.config.softwareRev
161
+ },
162
+ subtypeUUID
163
+ // subtype of the primary service for identification
164
+ );
165
+ this.onIdentify = AccessoryUtils.onIdentify;
166
+ this.accessory.on("identify", this.onIdentify);
167
+ }
168
+ } else {
169
+ log.debug("Binding Service accessory as Standalone Accessory");
170
+ this.accessory = this.hostNode.host;
171
+ }
172
+ this.service = ServiceUtils.getOrCreate(
173
+ this.accessory,
174
+ {
175
+ name: this.name,
176
+ UUID: subtypeUUID,
177
+ serviceName: this.config.serviceName,
178
+ config: this.config
179
+ },
180
+ this.parentService
181
+ );
182
+ this.characteristicProperties = CharacteristicUtils.load(
183
+ this.service,
184
+ this.config
185
+ );
186
+ ServiceUtils.configureAdaptiveLightning();
187
+ if (this.config.isParent) {
188
+ BridgeUtils.delayedPublish(this);
189
+ }
190
+ this.nodeStatusUtils.setStatus({
191
+ fill: "yellow",
192
+ shape: "ring",
193
+ text: this.hostNode.config.pinCode
194
+ });
195
+ this.supported = CharacteristicUtils.subscribeAndGetSupported(
196
+ this.service
197
+ );
198
+ this.on("input", ServiceUtils.onInput);
199
+ this.on("close", ServiceUtils.onClose);
200
+ };
201
+ return {
202
+ preInit,
203
+ init
204
+ };
178
205
  };