@iobroker/js-controller-adapter 6.0.6 → 6.0.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.
@@ -350,7 +350,7 @@ export declare class AdapterClass extends EventEmitter {
350
350
  /** contents of package.json */
351
351
  pack?: Record<string, any>;
352
352
  /** contents of io-package.json */
353
- ioPack: Record<string, any>;
353
+ ioPack: ioBroker.InstanceObject;
354
354
  private _initializeTimeout?;
355
355
  private inited?;
356
356
  /** contents of iobroker.json if required via AdapterOptions */
@@ -782,6 +782,13 @@ export declare class AdapterClass extends EventEmitter {
782
782
  * @param options information about version to remove feature and the log message
783
783
  */
784
784
  private reportDeprecation;
785
+ /**
786
+ * Initialize the plugin handler for this adapter
787
+ */
788
+ private _initPluginHandler;
789
+ /**
790
+ * Initializes the adapter
791
+ */
785
792
  private _init;
786
793
  }
787
794
  /**
@@ -5828,8 +5828,8 @@ class AdapterClass extends import_node_events.EventEmitter {
5828
5828
  }
5829
5829
  if (this.pluginHandler.isPluginActive(pluginName) !== state.val) {
5830
5830
  if (state.val) {
5831
- if (!this.pluginHandler.isPluginInstanciated(pluginName)) {
5832
- this.pluginHandler.instanciatePlugin(pluginName, this.pluginHandler.getPluginConfig(pluginName) || {}, thisDir);
5831
+ if (!this.pluginHandler.isPluginInstantiated(pluginName)) {
5832
+ this.pluginHandler.instantiatePlugin(pluginName, this.pluginHandler.getPluginConfig(pluginName) || {}, thisDir);
5833
5833
  this.pluginHandler.setDatabaseForPlugin(pluginName, this.#objects, this.#states);
5834
5834
  this.pluginHandler.initPlugin(pluginName, this.adapterConfig || {});
5835
5835
  }
@@ -6129,206 +6129,208 @@ class AdapterClass extends import_node_events.EventEmitter {
6129
6129
  return;
6130
6130
  }
6131
6131
  this.pluginHandler.setDatabaseForPlugins(this.#objects, this.#states);
6132
- this.pluginHandler.initPlugins(adapterConfig || {}, async () => {
6133
- if (!this.#states || !this.#objects || this.terminated) {
6134
- return;
6135
- }
6136
- this.#states.subscribe(`system.adapter.${this.namespace}.plugins.*`);
6137
- if (this._options.instance === void 0) {
6138
- if (!adapterConfig || !("common" in adapterConfig) || !adapterConfig.common.enabled) {
6139
- if (adapterConfig && "common" in adapterConfig && adapterConfig.common.enabled !== void 0) {
6140
- !this._config.isInstall && this._logger.error(`${this.namespaceLog} adapter disabled`);
6141
- } else {
6142
- !this._config.isInstall && this._logger.error(`${this.namespaceLog} no config found for adapter`);
6143
- }
6144
- if (!this._config.isInstall && (!process.argv || !this._config.forceIfDisabled)) {
6145
- const id = `system.adapter.${this.namespace}`;
6146
- this.outputCount += 2;
6147
- this.#states.setState(`${id}.alive`, { val: true, ack: true, expire: 30, from: id });
6148
- let done = false;
6149
- this.#states.setState(`${id}.connected`, {
6150
- val: true,
6151
- ack: true,
6152
- expire: 30,
6153
- from: id
6154
- }, () => {
6155
- if (!done) {
6156
- done = true;
6157
- this.terminate(import_js_controller_common.EXIT_CODES.NO_ADAPTER_CONFIG_FOUND);
6158
- }
6159
- });
6160
- setTimeout(() => {
6161
- if (!done) {
6162
- done = true;
6163
- this.terminate(import_js_controller_common.EXIT_CODES.NO_ADAPTER_CONFIG_FOUND);
6164
- }
6165
- }, 1e3);
6166
- return;
6167
- }
6168
- }
6169
- if (!this._config.isInstall && (!adapterConfig || !("_id" in adapterConfig))) {
6170
- this._logger.error(`${this.namespaceLog} invalid config: no _id found`);
6171
- this.terminate(import_js_controller_common.EXIT_CODES.INVALID_ADAPTER_ID);
6172
- return;
6173
- }
6174
- let name;
6175
- let instance;
6176
- if (!this._config.isInstall) {
6177
- const tmp = adapterConfig._id.match(/^system\.adapter\.([a-zA-Z0-9-_]+)\.([0-9]+)$/);
6178
- if (!tmp) {
6179
- this._logger.error(`${this.namespaceLog} invalid config`);
6180
- this.terminate(import_js_controller_common.EXIT_CODES.INVALID_ADAPTER_ID);
6181
- return;
6182
- }
6183
- name = tmp[1];
6184
- instance = parseInt(tmp[2]) || 0;
6132
+ await this.pluginHandler.initPlugins(adapterConfig || {});
6133
+ if (!this.#states || !this.#objects || this.terminated) {
6134
+ return;
6135
+ }
6136
+ this.#states.subscribe(`system.adapter.${this.namespace}.plugins.*`);
6137
+ if (this._options.instance === void 0) {
6138
+ if (!adapterConfig || !("common" in adapterConfig) || !adapterConfig.common.enabled) {
6139
+ if (adapterConfig && "common" in adapterConfig && adapterConfig.common.enabled !== void 0) {
6140
+ !this._config.isInstall && this._logger.error(`${this.namespaceLog} adapter disabled`);
6185
6141
  } else {
6186
- name = this.name;
6187
- instance = 0;
6188
- adapterConfig = adapterConfig || {
6189
- common: { mode: "once", name, protectedNative: [] },
6190
- native: {}
6191
- };
6142
+ !this._config.isInstall && this._logger.error(`${this.namespaceLog} no config found for adapter`);
6192
6143
  }
6193
- if (adapterConfig.common.loglevel && !this.overwriteLogLevel) {
6194
- for (const trans of Object.values(this._logger.transports)) {
6195
- if (!trans._defaultConfigLoglevel) {
6196
- trans.level = adapterConfig.common.loglevel;
6144
+ if (!this._config.isInstall && (!process.argv || !this._config.forceIfDisabled)) {
6145
+ const id = `system.adapter.${this.namespace}`;
6146
+ this.outputCount += 2;
6147
+ this.#states.setState(`${id}.alive`, { val: true, ack: true, expire: 30, from: id });
6148
+ let done = false;
6149
+ this.#states.setState(`${id}.connected`, {
6150
+ val: true,
6151
+ ack: true,
6152
+ expire: 30,
6153
+ from: id
6154
+ }, () => {
6155
+ if (!done) {
6156
+ done = true;
6157
+ this.terminate(import_js_controller_common.EXIT_CODES.NO_ADAPTER_CONFIG_FOUND);
6197
6158
  }
6198
- }
6199
- this._config.log.level = adapterConfig.common.loglevel;
6200
- }
6201
- this.name = adapterConfig.common.name;
6202
- this.instance = instance;
6203
- this.namespace = `${name}.${instance}`;
6204
- this.namespaceLog = this.namespace + (this.startedInCompactMode ? " (COMPACT)" : ` (${process.pid})`);
6205
- if (!this.startedInCompactMode) {
6206
- process.title = `io.${this.namespace}`;
6207
- }
6208
- this.config = adapterConfig.native;
6209
- this.host = adapterConfig.common.host;
6210
- this.common = adapterConfig.common;
6211
- if (adapterConfig.common.mode === "schedule" || adapterConfig.common.mode === "once") {
6212
- this.stop = (params) => this._stop({ ...params, isPause: true });
6213
- } else if (this.startedInCompactMode) {
6214
- this.stop = (params) => this._stop({ ...params, isPause: false });
6215
- this.kill = this.stop;
6216
- } else {
6217
- this.stop = (params) => this._stop({ ...params, isPause: false });
6159
+ });
6160
+ setTimeout(() => {
6161
+ if (!done) {
6162
+ done = true;
6163
+ this.terminate(import_js_controller_common.EXIT_CODES.NO_ADAPTER_CONFIG_FOUND);
6164
+ }
6165
+ }, 1e3);
6166
+ return;
6218
6167
  }
6219
- this.#states.subscribe(`${import_constants2.SYSTEM_ADAPTER_PREFIX}*.logging`);
6220
- if (typeof this._options.message === "function" && !(0, import_utils.isMessageboxSupported)(adapterConfig.common)) {
6221
- this._logger.error(`${this.namespaceLog} : message handler implemented, but messagebox not enabled. Define common.messagebox in io-package.json for adapter or delete message handler.`);
6222
- } else if ((0, import_utils.isMessageboxSupported)(adapterConfig.common)) {
6223
- this.mboxSubscribed = true;
6224
- this.#states.subscribeMessage(`system.adapter.${this.namespace}`);
6168
+ }
6169
+ if (!this._config.isInstall && (!adapterConfig || !("_id" in adapterConfig))) {
6170
+ this._logger.error(`${this.namespaceLog} invalid config: no _id found`);
6171
+ this.terminate(import_js_controller_common.EXIT_CODES.INVALID_ADAPTER_ID);
6172
+ return;
6173
+ }
6174
+ let name;
6175
+ let instance;
6176
+ if (!this._config.isInstall) {
6177
+ const tmp = adapterConfig._id.match(/^system\.adapter\.([a-zA-Z0-9-_]+)\.([0-9]+)$/);
6178
+ if (!tmp) {
6179
+ this._logger.error(`${this.namespaceLog} invalid config`);
6180
+ this.terminate(import_js_controller_common.EXIT_CODES.INVALID_ADAPTER_ID);
6181
+ return;
6225
6182
  }
6183
+ name = tmp[1];
6184
+ instance = parseInt(tmp[2]) || 0;
6226
6185
  } else {
6227
- this.name = adapterConfig.name || this.name;
6228
- this.instance = adapterConfig.instance || 0;
6229
- this.namespace = `${this.name}.${this.instance}`;
6230
- this.namespaceLog = this.namespace + (this.startedInCompactMode ? " (COMPACT)" : ` (${process.pid})`);
6231
- this.config = adapterConfig.native || {};
6232
- this.common = adapterConfig.common || {};
6233
- this.host = this.common?.host || import_js_controller_common.tools.getHostName() || import_node_os.default.hostname();
6234
- }
6235
- this.adapterConfig = adapterConfig;
6236
- this._utils = new import_validator.Validator(this.#objects, this.#states, this.namespaceLog, this._logger, this.namespace, this._namespaceRegExp);
6237
- this.log = new import_log.Log(this.namespaceLog, this._config.log.level, this._logger);
6238
- await this._createInstancesObjects(adapterConfig);
6239
- if (this._options.objects) {
6240
- this.oObjects = await this.getAdapterObjectsAsync();
6241
- await this.subscribeObjectsAsync("*");
6242
- }
6243
- await this.getSystemSecret();
6244
- const promises = [];
6245
- if (Array.isArray(adapterConfig.encryptedNative)) {
6246
- for (const attr of adapterConfig.encryptedNative) {
6247
- if (typeof this.config[attr] === "string") {
6248
- promises.push(this.getEncryptedConfig(attr).then((decryptedValue) => this.config[attr] = decryptedValue).catch((e) => this._logger.error(`${this.namespaceLog} Can not decrypt attribute ${attr}: ${e.message}`)));
6249
- }
6250
- }
6186
+ name = this.name;
6187
+ instance = 0;
6188
+ adapterConfig = adapterConfig || {
6189
+ common: { mode: "once", name, protectedNative: [] },
6190
+ native: {}
6191
+ };
6192
+ }
6193
+ if (adapterConfig.common.loglevel && !this.overwriteLogLevel) {
6194
+ for (const trans of Object.values(this._logger.transports)) {
6195
+ if (!trans._defaultConfigLoglevel) {
6196
+ trans.level = adapterConfig.common.loglevel;
6197
+ }
6198
+ }
6199
+ this._config.log.level = adapterConfig.common.loglevel;
6200
+ }
6201
+ this.name = adapterConfig.common.name;
6202
+ this.instance = instance;
6203
+ this.namespace = `${name}.${instance}`;
6204
+ this.namespaceLog = this.namespace + (this.startedInCompactMode ? " (COMPACT)" : ` (${process.pid})`);
6205
+ if (!this.startedInCompactMode) {
6206
+ process.title = `io.${this.namespace}`;
6207
+ }
6208
+ this.config = adapterConfig.native;
6209
+ this.host = adapterConfig.common.host;
6210
+ this.common = adapterConfig.common;
6211
+ if (adapterConfig.common.mode === "schedule" || adapterConfig.common.mode === "once") {
6212
+ this.stop = (params) => this._stop({ ...params, isPause: true });
6213
+ } else if (this.startedInCompactMode) {
6214
+ this.stop = (params) => this._stop({ ...params, isPause: false });
6215
+ this.kill = this.stop;
6251
6216
  } else {
6252
- const idx = this.SUPPORTED_FEATURES.indexOf("ADAPTER_AUTO_DECRYPT_NATIVE");
6253
- if (idx !== -1) {
6254
- this.SUPPORTED_FEATURES.splice(idx, 1);
6217
+ this.stop = (params) => this._stop({ ...params, isPause: false });
6218
+ }
6219
+ this.#states.subscribe(`${import_constants2.SYSTEM_ADAPTER_PREFIX}*.logging`);
6220
+ if (typeof this._options.message === "function" && !(0, import_utils.isMessageboxSupported)(adapterConfig.common)) {
6221
+ this._logger.error(`${this.namespaceLog} : message handler implemented, but messagebox not enabled. Define common.messagebox in io-package.json for adapter or delete message handler.`);
6222
+ } else if ((0, import_utils.isMessageboxSupported)(adapterConfig.common)) {
6223
+ this.mboxSubscribed = true;
6224
+ this.#states.subscribeMessage(`system.adapter.${this.namespace}`);
6225
+ }
6226
+ } else {
6227
+ this.name = adapterConfig.name || this.name;
6228
+ this.instance = adapterConfig.instance || 0;
6229
+ this.namespace = `${this.name}.${this.instance}`;
6230
+ this.namespaceLog = this.namespace + (this.startedInCompactMode ? " (COMPACT)" : ` (${process.pid})`);
6231
+ this.config = adapterConfig.native || {};
6232
+ this.common = adapterConfig.common || {};
6233
+ this.host = this.common?.host || import_js_controller_common.tools.getHostName() || import_node_os.default.hostname();
6234
+ }
6235
+ this.adapterConfig = adapterConfig;
6236
+ this._utils = new import_validator.Validator(this.#objects, this.#states, this.namespaceLog, this._logger, this.namespace, this._namespaceRegExp);
6237
+ this.log = new import_log.Log(this.namespaceLog, this._config.log.level, this._logger);
6238
+ await this._createInstancesObjects(adapterConfig);
6239
+ if (this._options.objects) {
6240
+ this.oObjects = await this.getAdapterObjectsAsync();
6241
+ await this.subscribeObjectsAsync("*");
6242
+ }
6243
+ await this.getSystemSecret();
6244
+ const promises = [];
6245
+ if (Array.isArray(adapterConfig.encryptedNative)) {
6246
+ for (const attr of adapterConfig.encryptedNative) {
6247
+ if (typeof this.config[attr] === "string") {
6248
+ promises.push(this.getEncryptedConfig(attr).then((decryptedValue) => this.config[attr] = decryptedValue).catch((e) => this._logger.error(`${this.namespaceLog} Can not decrypt attribute ${attr}: ${e.message}`)));
6255
6249
  }
6256
6250
  }
6257
- await Promise.all(promises);
6258
- if (!this.#states) {
6259
- return;
6251
+ } else {
6252
+ const idx = this.SUPPORTED_FEATURES.indexOf("ADAPTER_AUTO_DECRYPT_NATIVE");
6253
+ if (idx !== -1) {
6254
+ this.SUPPORTED_FEATURES.splice(idx, 1);
6260
6255
  }
6261
- this.outputCount++;
6262
- this.#states.setState(`system.adapter.${this.namespace}.logLevel`, {
6263
- val: this._config.log.level,
6264
- ack: true,
6265
- from: `system.adapter.${this.namespace}`
6256
+ }
6257
+ await Promise.all(promises);
6258
+ if (!this.#states) {
6259
+ return;
6260
+ }
6261
+ this.outputCount++;
6262
+ this.#states.setState(`system.adapter.${this.namespace}.logLevel`, {
6263
+ val: this._config.log.level,
6264
+ ack: true,
6265
+ from: `system.adapter.${this.namespace}`
6266
+ });
6267
+ if (this._options.instance === void 0) {
6268
+ this.version = this.pack?.version ? this.pack.version : this.ioPack?.common ? this.ioPack.common.version : "unknown";
6269
+ const isNpmVersion = (0, import_js_controller_common.isInstalledFromNpm)({
6270
+ adapterName: this.name,
6271
+ installedFrom: this.ioPack.common.installedFrom
6266
6272
  });
6267
- if (this._options.instance === void 0) {
6268
- this.version = this.pack?.version ? this.pack.version : this.ioPack?.common ? this.ioPack.common.version : "unknown";
6269
- const isNpmVersion = !this.ioPack || !this.ioPack.common || typeof this.ioPack.common.installedFrom !== "string" || this.ioPack.common.installedFrom.startsWith(`${import_js_controller_common.tools.appName.toLowerCase()}.${this.name}`);
6270
- this._logger.info(`${this.namespaceLog} starting. Version ${this.version} ${!isNpmVersion ? `(non-npm: ${this.ioPack.common.installedFrom}) ` : ""}in ${this.adapterDir}, node: ${process.version}, js-controller: ${controllerVersion}`);
6271
- this._config.system = this._config.system || {};
6272
- this._config.system.statisticsInterval = parseInt(this._config.system.statisticsInterval, 10) || 15e3;
6273
- if (!this._config.isInstall) {
6274
- this._reportInterval = setInterval(() => this._reportStatus(), this._config.system.statisticsInterval);
6275
- this._reportStatus();
6276
- const id = `system.adapter.${this.namespace}`;
6277
- this.#states.setState(`${id}.compactMode`, {
6278
- ack: true,
6279
- from: id,
6280
- val: !!this.startedInCompactMode
6273
+ this._logger.info(`${this.namespaceLog} starting. Version ${this.version} ${!isNpmVersion ? `(non-npm: ${this.ioPack.common.installedFrom}) ` : ""}in ${this.adapterDir}, node: ${process.version}, js-controller: ${controllerVersion}`);
6274
+ this._config.system = this._config.system || {};
6275
+ this._config.system.statisticsInterval = parseInt(this._config.system.statisticsInterval, 10) || 15e3;
6276
+ if (!this._config.isInstall) {
6277
+ this._reportInterval = setInterval(() => this._reportStatus(), this._config.system.statisticsInterval);
6278
+ this._reportStatus();
6279
+ const id = `system.adapter.${this.namespace}`;
6280
+ this.#states.setState(`${id}.compactMode`, {
6281
+ ack: true,
6282
+ from: id,
6283
+ val: !!this.startedInCompactMode
6284
+ });
6285
+ this.outputCount++;
6286
+ if (this.startedInCompactMode) {
6287
+ this.#states.setState(`${id}.cpu`, { ack: true, from: id, val: 0 });
6288
+ this.#states.setState(`${id}.cputime`, { ack: true, from: id, val: 0 });
6289
+ this.#states.setState(`${id}.memRss`, { val: 0, ack: true, from: id });
6290
+ this.#states.setState(`${id}.memHeapTotal`, { val: 0, ack: true, from: id });
6291
+ this.#states.setState(`${id}.memHeapUsed`, { val: 0, ack: true, from: id });
6292
+ this.#states.setState(`${id}.eventLoopLag`, { val: 0, ack: true, from: id });
6293
+ this.outputCount += 6;
6294
+ } else {
6295
+ import_js_controller_common.tools.measureEventLoopLag(1e3, (lag) => {
6296
+ if (lag) {
6297
+ this.eventLoopLags.push(lag);
6298
+ }
6281
6299
  });
6282
- this.outputCount++;
6283
- if (this.startedInCompactMode) {
6284
- this.#states.setState(`${id}.cpu`, { ack: true, from: id, val: 0 });
6285
- this.#states.setState(`${id}.cputime`, { ack: true, from: id, val: 0 });
6286
- this.#states.setState(`${id}.memRss`, { val: 0, ack: true, from: id });
6287
- this.#states.setState(`${id}.memHeapTotal`, { val: 0, ack: true, from: id });
6288
- this.#states.setState(`${id}.memHeapUsed`, { val: 0, ack: true, from: id });
6289
- this.#states.setState(`${id}.eventLoopLag`, { val: 0, ack: true, from: id });
6290
- this.outputCount += 6;
6291
- } else {
6292
- import_js_controller_common.tools.measureEventLoopLag(1e3, (lag) => {
6293
- if (lag) {
6294
- this.eventLoopLags.push(lag);
6295
- }
6296
- });
6297
- }
6298
6300
  }
6299
6301
  }
6300
- if (adapterConfig && "common" in adapterConfig && adapterConfig.common.restartSchedule) {
6301
- try {
6302
- this._schedule = await import("node-schedule");
6303
- } catch {
6304
- this._logger.error(`${this.namespaceLog} Cannot load node-schedule. Scheduled restart is disabled`);
6305
- }
6306
- if (this._schedule) {
6307
- this._logger.debug(`${this.namespaceLog} Schedule restart: ${adapterConfig.common.restartSchedule}`);
6308
- this._restartScheduleJob = this._schedule.scheduleJob(adapterConfig.common.restartSchedule, () => {
6309
- this._logger.info(`${this.namespaceLog} Scheduled restart.`);
6310
- this._stop({ isPause: false, isScheduled: true });
6311
- });
6312
- }
6302
+ }
6303
+ if (adapterConfig && "common" in adapterConfig && adapterConfig.common.restartSchedule) {
6304
+ try {
6305
+ this._schedule = await import("node-schedule");
6306
+ } catch {
6307
+ this._logger.error(`${this.namespaceLog} Cannot load node-schedule. Scheduled restart is disabled`);
6313
6308
  }
6314
- if (this._options.states) {
6315
- this.getStates("*", null, (err, _states) => {
6316
- if (this._stopInProgress) {
6317
- return;
6318
- }
6319
- this.oStates = _states;
6320
- this.subscribeStates("*");
6321
- if (this._firstConnection) {
6322
- this._firstConnection = false;
6323
- this._callReadyHandler();
6324
- }
6325
- this.adapterReady = true;
6309
+ if (this._schedule) {
6310
+ this._logger.debug(`${this.namespaceLog} Schedule restart: ${adapterConfig.common.restartSchedule}`);
6311
+ this._restartScheduleJob = this._schedule.scheduleJob(adapterConfig.common.restartSchedule, () => {
6312
+ this._logger.info(`${this.namespaceLog} Scheduled restart.`);
6313
+ this._stop({ isPause: false, isScheduled: true });
6326
6314
  });
6327
- } else if (!this._stopInProgress) {
6328
- this._callReadyHandler();
6329
- this.adapterReady = true;
6330
6315
  }
6331
- });
6316
+ }
6317
+ if (this._options.states) {
6318
+ this.getStates("*", null, (err, _states) => {
6319
+ if (this._stopInProgress) {
6320
+ return;
6321
+ }
6322
+ this.oStates = _states;
6323
+ this.subscribeStates("*");
6324
+ if (this._firstConnection) {
6325
+ this._firstConnection = false;
6326
+ this._callReadyHandler();
6327
+ }
6328
+ this.adapterReady = true;
6329
+ });
6330
+ } else if (!this._stopInProgress) {
6331
+ this._callReadyHandler();
6332
+ this.adapterReady = true;
6333
+ }
6332
6334
  }
6333
6335
  _callReadyHandler() {
6334
6336
  if (this._config.isInstall && (typeof this._options.install === "function" || this.listeners("install").length)) {
@@ -6529,6 +6531,23 @@ class AdapterClass extends import_node_events.EventEmitter {
6529
6531
  };
6530
6532
  await this.#states.pushMessage(`system.host.${this.host}`, obj);
6531
6533
  }
6534
+ _initPluginHandler() {
6535
+ const pluginSettings = {
6536
+ scope: "adapter",
6537
+ namespace: `system.adapter.${this.namespace}`,
6538
+ logNamespace: this.namespaceLog,
6539
+ log: this._logger,
6540
+ iobrokerConfig: this._config,
6541
+ parentPackage: this.pack,
6542
+ controllerVersion
6543
+ };
6544
+ this.pluginHandler = new import_plugin_base.PluginHandler(pluginSettings);
6545
+ try {
6546
+ this.pluginHandler.addPlugins(this.ioPack.common.plugins || {}, [this.adapterDir, thisDir]);
6547
+ } catch (e) {
6548
+ this._logger.error(`Could not add plugins: ${e.message}`);
6549
+ }
6550
+ }
6532
6551
  async _init() {
6533
6552
  const _initDBs = () => {
6534
6553
  this._initObjects(() => {
@@ -6583,21 +6602,7 @@ class AdapterClass extends import_node_events.EventEmitter {
6583
6602
  process.once("exit", () => this._stop());
6584
6603
  process.on("uncaughtException", (err) => this._exceptionHandler(err));
6585
6604
  process.on("unhandledRejection", (err) => this._exceptionHandler(err, true));
6586
- const pluginSettings = {
6587
- scope: "adapter",
6588
- namespace: `system.adapter.${this.namespace}`,
6589
- logNamespace: this.namespaceLog,
6590
- log: this._logger,
6591
- iobrokerConfig: this._config,
6592
- parentPackage: this.pack,
6593
- controllerVersion
6594
- };
6595
- this.pluginHandler = new import_plugin_base.PluginHandler(pluginSettings);
6596
- try {
6597
- this.pluginHandler.addPlugins(this.ioPack.common.plugins, [this.adapterDir, thisDir]);
6598
- } catch (e) {
6599
- this._logger.error(`Could not add plugins: ${e.message}`);
6600
- }
6605
+ this._initPluginHandler();
6601
6606
  _initDBs();
6602
6607
  }
6603
6608
  }