@iobroker/js-controller-adapter 6.0.7 → 6.0.8
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.
- package/build/cjs/lib/adapter/adapter.js +187 -186
- package/build/cjs/lib/adapter/adapter.js.map +2 -2
- package/build/esm/lib/adapter/adapter.d.ts.map +1 -1
- package/build/esm/lib/adapter/adapter.js +235 -234
- package/build/esm/lib/adapter/adapter.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +12 -11
|
@@ -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.
|
|
5832
|
-
this.pluginHandler.
|
|
5831
|
+
if (!this.pluginHandler.isPluginInstanciated(pluginName)) {
|
|
5832
|
+
this.pluginHandler.instanciatePlugin(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,208 +6129,209 @@ class AdapterClass extends import_node_events.EventEmitter {
|
|
|
6129
6129
|
return;
|
|
6130
6130
|
}
|
|
6131
6131
|
this.pluginHandler.setDatabaseForPlugins(this.#objects, this.#states);
|
|
6132
|
-
|
|
6133
|
-
|
|
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);
|
|
6132
|
+
this.pluginHandler.initPlugins(adapterConfig || {}, async () => {
|
|
6133
|
+
if (!this.#states || !this.#objects || this.terminated) {
|
|
6172
6134
|
return;
|
|
6173
6135
|
}
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
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`);
|
|
6180
6171
|
this.terminate(import_js_controller_common.EXIT_CODES.INVALID_ADAPTER_ID);
|
|
6181
6172
|
return;
|
|
6182
6173
|
}
|
|
6183
|
-
name
|
|
6184
|
-
instance
|
|
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;
|
|
6185
|
+
} else {
|
|
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;
|
|
6216
|
+
} else {
|
|
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
|
+
}
|
|
6185
6226
|
} else {
|
|
6186
|
-
name = this.name;
|
|
6187
|
-
instance = 0;
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
};
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
this.
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
this.
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
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;
|
|
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
|
+
}
|
|
6216
6251
|
} else {
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
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}`)));
|
|
6252
|
+
const idx = this.SUPPORTED_FEATURES.indexOf("ADAPTER_AUTO_DECRYPT_NATIVE");
|
|
6253
|
+
if (idx !== -1) {
|
|
6254
|
+
this.SUPPORTED_FEATURES.splice(idx, 1);
|
|
6249
6255
|
}
|
|
6250
6256
|
}
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
this.SUPPORTED_FEATURES.splice(idx, 1);
|
|
6257
|
+
await Promise.all(promises);
|
|
6258
|
+
if (!this.#states) {
|
|
6259
|
+
return;
|
|
6255
6260
|
}
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
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
|
|
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}`
|
|
6272
6266
|
});
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
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
|
|
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
|
|
6284
6272
|
});
|
|
6285
|
-
this.
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
this
|
|
6290
|
-
this
|
|
6291
|
-
|
|
6292
|
-
this.#states.setState(`${id}.
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
if (lag) {
|
|
6297
|
-
this.eventLoopLags.push(lag);
|
|
6298
|
-
}
|
|
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
|
|
6299
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
|
+
}
|
|
6299
|
+
});
|
|
6300
|
+
}
|
|
6300
6301
|
}
|
|
6301
6302
|
}
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
this._logger.error(`${this.namespaceLog} Cannot load node-schedule. Scheduled restart is disabled`);
|
|
6308
|
-
}
|
|
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 });
|
|
6314
|
-
});
|
|
6315
|
-
}
|
|
6316
|
-
}
|
|
6317
|
-
if (this._options.states) {
|
|
6318
|
-
this.getStates("*", null, (err, _states) => {
|
|
6319
|
-
if (this._stopInProgress) {
|
|
6320
|
-
return;
|
|
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`);
|
|
6321
6308
|
}
|
|
6322
|
-
this.
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
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 });
|
|
6314
|
+
});
|
|
6327
6315
|
}
|
|
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();
|
|
6328
6332
|
this.adapterReady = true;
|
|
6329
|
-
}
|
|
6330
|
-
}
|
|
6331
|
-
this._callReadyHandler();
|
|
6332
|
-
this.adapterReady = true;
|
|
6333
|
-
}
|
|
6333
|
+
}
|
|
6334
|
+
});
|
|
6334
6335
|
}
|
|
6335
6336
|
_callReadyHandler() {
|
|
6336
6337
|
if (this._config.isInstall && (typeof this._options.install === "function" || this.listeners("install").length)) {
|