diff --git a/README.md b/README.md index 6afff65..9f7ae0e 100755 --- a/README.md +++ b/README.md @@ -122,6 +122,10 @@ States: ### **WORK IN PROGRESS** --> ## Changelog +### **WORK IN PROGRESS** + +* (bluefox) Sanitize the IDs of the clients + ### 3.2.0 (2024-08-28) * (bluefox) Added information about connected clients in the server mode diff --git a/lib/server.js b/lib/server.js index b131525..51f784e 100644 --- a/lib/server.js +++ b/lib/server.js @@ -616,7 +616,7 @@ function MQTTServer(adapter) { setStateImmediate(mappingClients[channelId], stateId, state.val ? 'ON' : 'OFF'); break; case 'number': - setStateImmediate(mappingClients[channelId], stateId, (state.val === null) ? '' : state.val.toString()); + setStateImmediate(mappingClients[channelId], stateId, state.val === null ? '' : state.val.toString()); break; case 'string': setStateImmediate(mappingClients[channelId], stateId, (state.val === null) ? '' : state.val.toString()); @@ -819,7 +819,7 @@ function MQTTServer(adapter) { const clientIds = []; if (clients) { for (const id in clients) { - const oid = `info.clients.${id.replace(/[.\s]+/g, '_')}`; + const oid = `info.clients.${id.replace(/[.\s]+/g, '_').replace(FORBIDDEN_CHARS, '_')}`; clientIds.push(oid); const clientObj = await adapter.getObjectAsync(oid); if (!clientObj?.native) { @@ -837,10 +837,15 @@ function MQTTServer(adapter) { port: clients[id].stream.remotePort, }, }); - } else if (clientObj.native.port !== clients[id].stream.remotePort || clientObj.native.ip !== clients[id].stream.remoteAddress) { - clientObj.native.port = clients[id].stream.remotePort; - clientObj.native.ip = clients[id].stream.remoteAddress; - adapter.setObject(clientObj._id, clientObj); + } else { + if (clients[id] && + (clientObj.native.port !== clients[id].stream.remotePort || + clientObj.native.ip !== clients[id].stream.remoteAddress) + ) { + clientObj.native.port = clients[id].stream.remotePort; + clientObj.native.ip = clients[id].stream.remoteAddress; + adapter.setObject(clientObj._id, clientObj); + } } await adapter.setStateAsync(oid, true, true); } @@ -954,13 +959,13 @@ function MQTTServer(adapter) { // check for arrays if (types[attr]) { if (types[attr].type === 'array') { - // transform to array of attributes + // transform to an array of attributes for (let i = 1; i <= 10; i++) { let val = data[attr][i - 1]; if (typeof val === 'undefined') { break; } - // define new object + // define a new object let replaceAttr = attr.replace(FORBIDDEN_CHARS, '_') + i.toString(); let id = `${adapter.namespace}.${client.iobId}.${prefix ? `${prefix}.` : ''}${path.length ? `${path.join('_')}_` : ''}${replaceAttr}`; let obj = { @@ -1337,7 +1342,7 @@ function MQTTServer(adapter) { // stat/sonoff/POWER if (types[stateId]) { - let id = `${adapter.namespace}.${client.iobId}.${stateId.replace(/[-.+\s]+/g, '_')}`; + let id = `${adapter.namespace}.${client.iobId}.${stateId.replace(/[-.+\s]+/g, '_').replace(FORBIDDEN_CHARS, '_')}`; let obj = { type: 'addObject', id: id, @@ -1485,12 +1490,12 @@ function MQTTServer(adapter) { // client connected client.on('connect', options => { - // acknowledge the connect packet + // acknowledge the "connect" packet client.id = options.clientId; client.iobId = client.id.replace(FORBIDDEN_CHARS, '_'); mappingClients[client.iobId] = client.id; - // get possible old client + // get possible an old client let oldClient = clients[client.id]; if (config.user) { @@ -1594,7 +1599,7 @@ function MQTTServer(adapter) { } if (packet.qos === 1) { - // send PUBACK to client + // send PUBACK to a client client.puback({messageId: packet.messageId}); } else if (packet.qos === 2) { const pack = client._messages && client._messages.find(e => e.messageId === packet.messageId); diff --git a/main.js b/main.js index c7aed06..eac3eda 100644 --- a/main.js +++ b/main.js @@ -1,11 +1,9 @@ /** - * * ioBroker sonoff Adapter * * (c) 2017-2024 bluefox * * MIT License - * */ 'use strict'; diff --git a/package-lock.json b/package-lock.json index 9ab1263..f8e7451 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "3.2.0", "license": "MIT", "dependencies": { - "@iobroker/adapter-core": "^3.1.6", + "@iobroker/adapter-core": "^3.2.2", "mqtt-connection": "^4.1.0" }, "devDependencies": { @@ -19,7 +19,7 @@ "@alcalzone/release-script-plugin-manual-review": "^3.7.0", "@iobroker/adapter-dev": "^1.3.0", "@iobroker/legacy-testing": "^1.0.13", - "@iobroker/testing": "^4.1.3", + "@iobroker/testing": "^5.0.0", "chai": "^4.5.0", "mocha": "^10.7.3", "mqtt": "^5.10.1" @@ -869,14 +869,15 @@ } }, "node_modules/@iobroker/adapter-core": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/@iobroker/adapter-core/-/adapter-core-3.1.6.tgz", - "integrity": "sha512-cArv8IzVsP3r8HivsYwO02e5WueboIH9v66PkHSGtadeUQQKUyxV32dzirM6YArWcI6+Iw5USQgVR9E+ryP3xg==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@iobroker/adapter-core/-/adapter-core-3.2.2.tgz", + "integrity": "sha512-Cuiga42WRkJ/NduyrIGgSVWpLgD6ihIflIvZiWVThwgWfDyI+Okgw3snVSlf/p4ki6BAr3MH6Dfa0qPySCGWvQ==", + "license": "MIT", "engines": { - "npm": ">=7.0.0" + "node": ">=16" }, "peerDependencies": { - "@iobroker/types": "^6.0.0" + "@iobroker/types": "^6.0.11" } }, "node_modules/@iobroker/adapter-dev": { @@ -927,25 +928,42 @@ } }, "node_modules/@iobroker/testing": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/@iobroker/testing/-/testing-4.1.3.tgz", - "integrity": "sha512-PTfvlXQBXDJVX35bkJxzgjuMX6bEjUmB4Dy8+bWLqbOgyq1JQVrRn+ah5IB7hEf+4lP8wD0MpAjXFJTv3zfTvA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@iobroker/testing/-/testing-5.0.0.tgz", + "integrity": "sha512-JrtWaGrgTU5MGRZowwyrDHVz8nzh/1QUqiOo1g9SXrRwT3PH0f6wRQKfe/RKiULFD2O4N3isc7pqyZg/uv4wdA==", "dev": true, + "license": "MIT", "dependencies": { - "alcalzone-shared": "~4.0.3", - "chai": "^4.3.7", - "chai-as-promised": "^7.1.1", - "debug": "^4.3.4", - "fs-extra": "^10.1.0", - "mocha": "^10.2.0", - "sinon": "^15.0.1", + "alcalzone-shared": "~4.0.8", + "chai": "^4.5.0", + "chai-as-promised": "^7.1.2", + "debug": "^4.3.7", + "fs-extra": "^11.2.0", + "mocha": "^10.7.3", + "sinon": "^19.0.2", "sinon-chai": "^3.7.0" } }, + "node_modules/@iobroker/testing/node_modules/fs-extra": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, "node_modules/@iobroker/types": { - "version": "6.0.10", - "resolved": "https://registry.npmjs.org/@iobroker/types/-/types-6.0.10.tgz", - "integrity": "sha512-3OT4a4QbLuWujobiea+zWA5JIksVdf0diZYzxcEv8W5BuvV5DUR3HlCUzXhLfF6X8Jgc+uFt3wRQ1s+m9v4/aw==", + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/@iobroker/types/-/types-6.0.11.tgz", + "integrity": "sha512-RNDURjtL5Cm9wt6ocCqdRi86Qx1350zBIvvrJ9+Fjgasoi6cWCdoOghkwEeb95TH2j//q/uLqWwL8SZ0vxx6Kw==", + "license": "MIT", "peer": true, "engines": { "node": ">=12.0.0" @@ -1032,6 +1050,7 @@ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "type-detect": "4.0.8" } @@ -1041,53 +1060,39 @@ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/@sinonjs/fake-timers": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", - "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.2.tgz", + "integrity": "sha512-4Bb+oqXZTSTZ1q27Izly9lv8B9dlV61CROxPiVtywwzv5SnytJqhvYe6FclHYuXml4cd1VHPo1zd5PmTeJozvA==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^3.0.0" + "@sinonjs/commons": "^3.0.1" } }, "node_modules/@sinonjs/samsam": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.0.tgz", - "integrity": "sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.2.tgz", + "integrity": "sha512-v46t/fwnhejRSFTGqbpn9u+LQ9xJDse10gNnPgAcxgdoCDMXj/G2asWAC/8Qs+BAZDicX+MNZouXT1A7c83kVw==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^2.0.0", + "@sinonjs/commons": "^3.0.1", "lodash.get": "^4.4.2", - "type-detect": "^4.0.8" - } - }, - "node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", - "dev": true, - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@sinonjs/samsam/node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" + "type-detect": "^4.1.0" } }, "node_modules/@sinonjs/text-encoding": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz", - "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", - "dev": true + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.3.tgz", + "integrity": "sha512-DE427ROAphMQzU4ENbliGYrBSYPXF+TtLg9S8vzeA+OF4ZKzoDdzfL8sxuMUGS/lgRhM6j1URSk9ghf7Xo1tyA==", + "dev": true, + "license": "(Unlicense OR Apache-2.0)" }, "node_modules/@tootallnate/once": { "version": "2.0.0", @@ -1676,11 +1681,12 @@ } }, "node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -2640,7 +2646,8 @@ "version": "6.2.0", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/jwa": { "version": "2.0.0", @@ -2725,7 +2732,8 @@ "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/log-symbols": { "version": "4.1.0", @@ -2930,12 +2938,6 @@ "wrap-ansi": "^7.0.0" } }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, "node_modules/mocha/node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -3126,30 +3128,23 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/nise": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.9.tgz", - "integrity": "sha512-qOnoujW4SV6e40dYxJOb3uvuoPHtmLzIk4TFo+j0jPJoC+5Z9xja5qH5JZobEPsa8+YYphMrOSwnrshEhG2qww==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/nise/-/nise-6.1.1.tgz", + "integrity": "sha512-aMSAzLVY7LyeM60gvBS423nBmIPP+Wy7St7hsb+8/fc1HmeoHJfLO8CKse4u3BtOZvQLJghYPI2i/1WZrEj5/g==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^3.0.0", - "@sinonjs/fake-timers": "^11.2.2", - "@sinonjs/text-encoding": "^0.7.2", + "@sinonjs/commons": "^3.0.1", + "@sinonjs/fake-timers": "^13.0.1", + "@sinonjs/text-encoding": "^0.7.3", "just-extend": "^6.2.0", - "path-to-regexp": "^6.2.1" - } - }, - "node_modules/nise/node_modules/@sinonjs/fake-timers": { - "version": "11.2.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz", - "integrity": "sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^3.0.0" + "path-to-regexp": "^8.1.0" } }, "node_modules/node-fetch": { @@ -3310,10 +3305,14 @@ } }, "node_modules/path-to-regexp": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", - "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==", - "dev": true + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", + "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + } }, "node_modules/pathval": { "version": "1.1.1", @@ -3603,17 +3602,17 @@ "dev": true }, "node_modules/sinon": { - "version": "15.2.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-15.2.0.tgz", - "integrity": "sha512-nPS85arNqwBXaIsFCkolHjGIkFo+Oxu9vbgmBJizLAhqe6P2o3Qmj3KCUoRkfhHtvgDhZdWD3risLHAUJ8npjw==", - "deprecated": "16.1.1", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-19.0.2.tgz", + "integrity": "sha512-euuToqM+PjO4UgXeLETsfQiuoyPXlqFezr6YZDFwHR3t4qaX0fZUe1MfPMznTL5f8BWrVS89KduLdMUsxFCO6g==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^3.0.0", - "@sinonjs/fake-timers": "^10.3.0", - "@sinonjs/samsam": "^8.0.0", - "diff": "^5.1.0", - "nise": "^5.1.4", + "@sinonjs/commons": "^3.0.1", + "@sinonjs/fake-timers": "^13.0.2", + "@sinonjs/samsam": "^8.0.1", + "diff": "^7.0.0", + "nise": "^6.1.1", "supports-color": "^7.2.0" }, "funding": { @@ -3631,6 +3630,16 @@ "sinon": ">=4.0.0" } }, + "node_modules/sinon/node_modules/diff": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/sinon/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", diff --git a/package.json b/package.json index 307db6c..ec965a4 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "esp" ], "dependencies": { - "@iobroker/adapter-core": "^3.1.6", + "@iobroker/adapter-core": "^3.2.2", "mqtt-connection": "^4.1.0" }, "devDependencies": { @@ -26,7 +26,7 @@ "@alcalzone/release-script-plugin-manual-review": "^3.7.0", "@iobroker/adapter-dev": "^1.3.0", "@iobroker/legacy-testing": "^1.0.13", - "@iobroker/testing": "^4.1.3", + "@iobroker/testing": "^5.0.0", "mqtt": "^5.10.1", "mocha": "^10.7.3", "chai": "^4.5.0" diff --git a/test/testServer.js b/test/testServer.js index 07d4ffd..184021e 100644 --- a/test/testServer.js +++ b/test/testServer.js @@ -44,6 +44,7 @@ const rules = { 'stat/sonoff/RESULT': {send: '{"POWER": "ON"}', expect: {'RESULT': null}}, 'stat/sonoff/LWT': {send: 'someTopic', expect: {'LWT': null}}, 'stat/sonoff/ABC': {send: 'text', expect: {'ABC': null}}, + // This command overwrites the adresses of the devices 'tele/tasmota_0912A7/STATE': {send: '{"Time":"2021-05-02T18:08:19","Uptime":"0T03:15:43","UptimeSec":11743,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":11,"POWER":"ON","Wifi":{"AP":1,"SSId":"Skynet","BSSId":"3C:A6:2F:23:6A:94","Channel":6,"RSSI":52,"Signal":-74,"LinkCount":1,"Downtime":"0T00:00:07"}}', expect: {'Wifi_Downtime': '0T00:00:07'}}, 'tele/Hof/Lager/Tasmota/Relais/RFresv/Beleuchtung/UV/Beleuchtungsstaerke/Außenlampe/SENSOR': { @@ -254,11 +255,11 @@ describe('Sonoff server: Test mqtt server', () => { // give time to a client to receive all messages it('wait', done => { setTimeout(() => done(), 1000); - }).timeout(3000); + }).timeout(4000); - it.skip('Sonoff server: detector must receive cmnd/sonoff/POWER', done => { - checkAdapter2Mqtt('sonoff.0.Emitter_1.POWER', 'cmnd/sonoff/POWER', false, done); - }).timeout(2000); + it('Sonoff server: detector must receive tele/tasmota_0912A7/POWER', done => { + checkAdapter2Mqtt('sonoff.0.Emitter_1.POWER', 'tele/tasmota_0912A7/POWER', false, done); + }).timeout(4000); it('Sonoff Server: check reconnection', done => { mqttClientEmitter.stop(); @@ -271,7 +272,7 @@ describe('Sonoff server: Test mqtt server', () => { done(); }); }); - }).timeout(10000); + }).timeout(1000000); after('Sonoff Server: Stop js-controller', function (_done) { // let FUNCTION and not => here this.timeout(5000);