diff --git a/README.md b/README.md index 73cbfa8..9d72909 100644 --- a/README.md +++ b/README.md @@ -220,6 +220,12 @@ TBD --> ## Changelog + +### __WORK IN PROGRESS__ +* BREAKING: Please re-enter your ioBroker Pro Cloud Password! +* (@Apollon77) Makes sure the adapter is stopped before being updated +* (@Apollon77) Optimizes device discovery and allows to stop it again + ### 0.2.10 (2024-12-19) * (@bluefox) Makes the Adapter UI also available as standalone tab * (@bluefox) Added error details when adding the same state twice to a bridge or device diff --git a/io-package.json b/io-package.json index 2f704d1..bd93652 100644 --- a/io-package.json +++ b/io-package.json @@ -146,7 +146,9 @@ "keywords": [ "matter" ], + "eraseOnUpload": true, "stopTimeout": 30000, + "stopBeforeUpdate": true, "enabled": true, "compact": false, "singletonHost": true, @@ -167,11 +169,11 @@ } }, "protectedNative": [ - "password", + "pass", "login" ], "encryptedNative": [ - "password" + "pass" ], "native": { "interface": "", diff --git a/package-lock.json b/package-lock.json index cfe172a..01fc53f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,9 +13,9 @@ "@iobroker/dm-utils": "^0.6.11", "@iobroker/i18n": "^0.3.1", "@iobroker/type-detector": "^4.1.1", - "@matter/main": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/nodejs": "0.12.0-alpha.0-20241219-af74a6a14", - "@project-chip/matter.js": "0.12.0-alpha.0-20241219-af74a6a14", + "@matter/main": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/nodejs": "0.12.0-alpha.0-20241220-2c53108aa", + "@project-chip/matter.js": "0.12.0-alpha.0-20241220-2c53108aa", "axios": "^1.7.9", "jsonwebtoken": "^9.0.2" }, @@ -40,7 +40,7 @@ "node": ">=18" }, "optionalDependencies": { - "@matter/nodejs-ble": "0.12.0-alpha.0-20241219-af74a6a14" + "@matter/nodejs-ble": "0.12.0-alpha.0-20241220-2c53108aa" } }, "node_modules/@alcalzone/pak": { @@ -1001,64 +1001,64 @@ } }, "node_modules/@matter/general": { - "version": "0.12.0-alpha.0-20241219-af74a6a14", - "resolved": "https://registry.npmjs.org/@matter/general/-/general-0.12.0-alpha.0-20241219-af74a6a14.tgz", - "integrity": "sha512-owzkzrHWHKy68BIrb5KnzH2zsxgp6JdVN7OEDS1DwYI+gWL3OaCzusJ6+a7S1Iu9xJGggGKBdr0KhJsUF23efg==", + "version": "0.12.0-alpha.0-20241220-2c53108aa", + "resolved": "https://registry.npmjs.org/@matter/general/-/general-0.12.0-alpha.0-20241220-2c53108aa.tgz", + "integrity": "sha512-XqdQZ/uuN/HP0qZJ8FADeAKvqMnops1eYyggH05/dZ2du5kMykKsqKNbPU/bWXPts0qll5UR3tM7RMv5g5bifQ==", "license": "Apache-2.0", "dependencies": { "@noble/curves": "^1.7.0" } }, "node_modules/@matter/main": { - "version": "0.12.0-alpha.0-20241219-af74a6a14", - "resolved": "https://registry.npmjs.org/@matter/main/-/main-0.12.0-alpha.0-20241219-af74a6a14.tgz", - "integrity": "sha512-tELayoilXD/bC6G0MBxW9qirkU6Kj4Ncsb4r3H71cNhTQd0v6lMMoFHfZnqf1j4+4GJkOsNrGMndTKbhAqSMWw==", + "version": "0.12.0-alpha.0-20241220-2c53108aa", + "resolved": "https://registry.npmjs.org/@matter/main/-/main-0.12.0-alpha.0-20241220-2c53108aa.tgz", + "integrity": "sha512-6xTYl1JHaTi7O81/3mh37yHV79pgjjQfw51r5ummWfLKvHKKLCmU7b+L2Vjrhln3q1RhHvBX5P+E5DhudFA1Hg==", "license": "Apache-2.0", "dependencies": { - "@matter/general": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/model": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/node": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/protocol": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/types": "0.12.0-alpha.0-20241219-af74a6a14", + "@matter/general": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/model": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/node": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/protocol": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/types": "0.12.0-alpha.0-20241220-2c53108aa", "@noble/curves": "^1.7.0" }, "optionalDependencies": { - "@matter/nodejs": "0.12.0-alpha.0-20241219-af74a6a14" + "@matter/nodejs": "0.12.0-alpha.0-20241220-2c53108aa" } }, "node_modules/@matter/model": { - "version": "0.12.0-alpha.0-20241219-af74a6a14", - "resolved": "https://registry.npmjs.org/@matter/model/-/model-0.12.0-alpha.0-20241219-af74a6a14.tgz", - "integrity": "sha512-IyI5IQZR11UUMxYjFWdP2BrfV/PtJIcWiWqX8GYOk3+B1PltVu21l75q1XDI/+61mcbnmldwuA1DSGDV/jT+og==", + "version": "0.12.0-alpha.0-20241220-2c53108aa", + "resolved": "https://registry.npmjs.org/@matter/model/-/model-0.12.0-alpha.0-20241220-2c53108aa.tgz", + "integrity": "sha512-fB98xRQQW6SSXWkiZbfpD2fskelmVLdIzAZYcSywFi33tyYGk+tK3G48uBvIxWktr4CEF5dkfUBJa4/Hd3EDYA==", "license": "Apache-2.0", "dependencies": { - "@matter/general": "0.12.0-alpha.0-20241219-af74a6a14", + "@matter/general": "0.12.0-alpha.0-20241220-2c53108aa", "@noble/curves": "^1.7.0" } }, "node_modules/@matter/node": { - "version": "0.12.0-alpha.0-20241219-af74a6a14", - "resolved": "https://registry.npmjs.org/@matter/node/-/node-0.12.0-alpha.0-20241219-af74a6a14.tgz", - "integrity": "sha512-Mp3EgWp8ry1+LuFNSW07v28G128xBpvnONXM+6/V5P3C3q9jznJfa/icJo27UZBOQQ2hGm9iugwSoFrzDVT7mw==", + "version": "0.12.0-alpha.0-20241220-2c53108aa", + "resolved": "https://registry.npmjs.org/@matter/node/-/node-0.12.0-alpha.0-20241220-2c53108aa.tgz", + "integrity": "sha512-Jk50HXpKNW2Ncx148D1OhHo7Ap/hvGhyZIhNkvc3LR/nVxHsNPSF8gIXA8d8ISE3kEiw616cJ6V8a00JvDb41w==", "license": "Apache-2.0", "dependencies": { - "@matter/general": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/model": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/protocol": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/types": "0.12.0-alpha.0-20241219-af74a6a14", + "@matter/general": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/model": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/protocol": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/types": "0.12.0-alpha.0-20241220-2c53108aa", "@noble/curves": "^1.7.0" } }, "node_modules/@matter/nodejs": { - "version": "0.12.0-alpha.0-20241219-af74a6a14", - "resolved": "https://registry.npmjs.org/@matter/nodejs/-/nodejs-0.12.0-alpha.0-20241219-af74a6a14.tgz", - "integrity": "sha512-cMFhXw9UtGGqff6LeOfPMB6UO7gAzQNd0XQr4oGQPiUyPnYm86pSN6youuFnZu/enSnczx5wanJS5yMCdCNKLg==", + "version": "0.12.0-alpha.0-20241220-2c53108aa", + "resolved": "https://registry.npmjs.org/@matter/nodejs/-/nodejs-0.12.0-alpha.0-20241220-2c53108aa.tgz", + "integrity": "sha512-u7j5K8JB01pASgzNFGBndJQsk/QSANihV0LR/ledUKhZUN/yh3nI81UWn1TAg3voliog2a7aTd0S8MuLQC6EOA==", "license": "Apache-2.0", "dependencies": { - "@matter/general": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/node": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/protocol": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/types": "0.12.0-alpha.0-20241219-af74a6a14", + "@matter/general": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/node": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/protocol": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/types": "0.12.0-alpha.0-20241220-2c53108aa", "node-localstorage": "^3.0.5" }, "engines": { @@ -1066,15 +1066,15 @@ } }, "node_modules/@matter/nodejs-ble": { - "version": "0.12.0-alpha.0-20241219-af74a6a14", - "resolved": "https://registry.npmjs.org/@matter/nodejs-ble/-/nodejs-ble-0.12.0-alpha.0-20241219-af74a6a14.tgz", - "integrity": "sha512-LPgya5J0UpPn793G12LJkOvg93jrRNsv2SH5pvCWitwUBZ/jFRfAp9wQjRFlbfMjkE5tanUGW97TQC1bZ+VRiA==", + "version": "0.12.0-alpha.0-20241220-2c53108aa", + "resolved": "https://registry.npmjs.org/@matter/nodejs-ble/-/nodejs-ble-0.12.0-alpha.0-20241220-2c53108aa.tgz", + "integrity": "sha512-v+MIuEDcZH+mFb1EU8Rz6yVFYWenl0P8mzBvvsd0BRyTYy5g1rPIGxlOmAW8LtmoBw6vqQIZ0jy/1ztUUP5ghQ==", "license": "Apache-2.0", "optional": true, "dependencies": { - "@matter/general": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/protocol": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/types": "0.12.0-alpha.0-20241219-af74a6a14" + "@matter/general": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/protocol": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/types": "0.12.0-alpha.0-20241220-2c53108aa" }, "engines": { "node": ">=18.0.0" @@ -1085,25 +1085,25 @@ } }, "node_modules/@matter/protocol": { - "version": "0.12.0-alpha.0-20241219-af74a6a14", - "resolved": "https://registry.npmjs.org/@matter/protocol/-/protocol-0.12.0-alpha.0-20241219-af74a6a14.tgz", - "integrity": "sha512-OgticMBIAiyO3m0uX/h6mF9D9ORDb6ZbCsbPi1gEatMjN7osfLz6vsSN8dbEKuZHKxC9MtfJmdz0ZW88xvJ2bg==", + "version": "0.12.0-alpha.0-20241220-2c53108aa", + "resolved": "https://registry.npmjs.org/@matter/protocol/-/protocol-0.12.0-alpha.0-20241220-2c53108aa.tgz", + "integrity": "sha512-lgs/uDNjrPXP7I5S64Wv5s8+YzimWsDWdWd6NdGgfGnoDkGsBs5RAZ2a8cYPwcJI8ARrAFZ5o4eFFNIwrEk6hw==", "license": "Apache-2.0", "dependencies": { - "@matter/general": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/model": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/types": "0.12.0-alpha.0-20241219-af74a6a14", + "@matter/general": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/model": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/types": "0.12.0-alpha.0-20241220-2c53108aa", "@noble/curves": "^1.7.0" } }, "node_modules/@matter/types": { - "version": "0.12.0-alpha.0-20241219-af74a6a14", - "resolved": "https://registry.npmjs.org/@matter/types/-/types-0.12.0-alpha.0-20241219-af74a6a14.tgz", - "integrity": "sha512-7reGBZvZcZpniHVLMF9MdW3zoT6VAaVUB4vUclbRezSQx1ZYreJVt5uKLWNQbqi0fvZMSMQc3jQVwyl9N6B8LA==", + "version": "0.12.0-alpha.0-20241220-2c53108aa", + "resolved": "https://registry.npmjs.org/@matter/types/-/types-0.12.0-alpha.0-20241220-2c53108aa.tgz", + "integrity": "sha512-yNKLXVtqpJVwAFU1M1JxX9kgTq5QHUH3jy2A8FdyMxr6MIYd0iw3cKfvZcEcr1cGutRvF1wSH13BLLGQaIcweA==", "license": "Apache-2.0", "dependencies": { - "@matter/general": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/model": "0.12.0-alpha.0-20241219-af74a6a14", + "@matter/general": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/model": "0.12.0-alpha.0-20241220-2c53108aa", "@noble/curves": "^1.7.0" } }, @@ -1266,16 +1266,16 @@ } }, "node_modules/@project-chip/matter.js": { - "version": "0.12.0-alpha.0-20241219-af74a6a14", - "resolved": "https://registry.npmjs.org/@project-chip/matter.js/-/matter.js-0.12.0-alpha.0-20241219-af74a6a14.tgz", - "integrity": "sha512-4PFQp0pEO9MIcqq77S4HxicCBwIvjnmxfqplcdgyNgu+ARSryPIqzN7v99u2uZN4CE8h0ih72Y6ElAMOK6h5lw==", + "version": "0.12.0-alpha.0-20241220-2c53108aa", + "resolved": "https://registry.npmjs.org/@project-chip/matter.js/-/matter.js-0.12.0-alpha.0-20241220-2c53108aa.tgz", + "integrity": "sha512-eKPH8e3M2ABBXCGxeIIollViic+Tta4AAQEvfao/7wahp3tO/dDOaUHrkCE/WXyL20o+PT8AL8LDo1ps31u05g==", "license": "Apache-2.0", "dependencies": { - "@matter/general": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/model": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/node": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/protocol": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/types": "0.12.0-alpha.0-20241219-af74a6a14", + "@matter/general": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/model": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/node": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/protocol": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/types": "0.12.0-alpha.0-20241220-2c53108aa", "@noble/curves": "^1.7.0" } }, diff --git a/package.json b/package.json index f99c998..9fd55f0 100644 --- a/package.json +++ b/package.json @@ -23,16 +23,16 @@ "url": "https://github.com/ioBroker/ioBroker.matter" }, "optionalDependencies": { - "@matter/nodejs-ble": "0.12.0-alpha.0-20241219-af74a6a14" + "@matter/nodejs-ble": "0.12.0-alpha.0-20241220-2c53108aa" }, "dependencies": { "@iobroker/adapter-core": "^3.2.3", "@iobroker/i18n": "^0.3.1", "@iobroker/dm-utils": "^0.6.11", "@iobroker/type-detector": "^4.1.1", - "@matter/main": "0.12.0-alpha.0-20241219-af74a6a14", - "@matter/nodejs": "0.12.0-alpha.0-20241219-af74a6a14", - "@project-chip/matter.js": "0.12.0-alpha.0-20241219-af74a6a14", + "@matter/main": "0.12.0-alpha.0-20241220-2c53108aa", + "@matter/nodejs": "0.12.0-alpha.0-20241220-2c53108aa", + "@project-chip/matter.js": "0.12.0-alpha.0-20241220-2c53108aa", "axios": "^1.7.9", "jsonwebtoken": "^9.0.2" }, diff --git a/src-admin/package-lock.json b/src-admin/package-lock.json index 9741cfc..682f2c7 100644 --- a/src-admin/package-lock.json +++ b/src-admin/package-lock.json @@ -1,12 +1,12 @@ { "name": "iobroker.matter", - "version": "0.2.9", + "version": "0.2.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "iobroker.matter", - "version": "0.2.9", + "version": "0.2.10", "dependencies": { "@foxriver76/iob-component-lib": "^0.2.0", "@iobroker/adapter-react-v5": "^7.4.7", diff --git a/src-admin/src/Tabs/Bridges.tsx b/src-admin/src/Tabs/Bridges.tsx index 5944624..73881ce 100644 --- a/src-admin/src/Tabs/Bridges.tsx +++ b/src-admin/src/Tabs/Bridges.tsx @@ -956,9 +956,9 @@ export class Bridges extends BridgesAndDevices { devicesInBridge={this.props.matter.bridges[this.state.addDeviceDialog.bridgeIndex].list.length} checkAddedDevices={ this.props.nodeStates[this.props.matter.bridges[this.state.addDeviceDialog.bridgeIndex].uuid] - .status === 'waitingForCommissioning' - ? MAX_UN_COMMISSIONED_DEVICES - : 0 + ?.status !== 'waitingForCommissioning' + ? 0 + : MAX_UN_COMMISSIONED_DEVICES } matter={this.props.matter} socket={this.props.socket} diff --git a/src-admin/src/Tabs/BridgesAndDevices.tsx b/src-admin/src/Tabs/BridgesAndDevices.tsx index 221a37d..72554d1 100644 --- a/src-admin/src/Tabs/BridgesAndDevices.tsx +++ b/src-admin/src/Tabs/BridgesAndDevices.tsx @@ -713,8 +713,9 @@ class BridgesAndDevices - {this.props.nodeStates[this.state.showResetDialog.bridgeOrDevice.uuid].status !== - 'waitingForCommissioning' ? ( + {this.props.nodeStates[this.state.showResetDialog.bridgeOrDevice.uuid] && + this.props.nodeStates[this.state.showResetDialog.bridgeOrDevice.uuid].status !== + 'waitingForCommissioning' ? (

{I18n.t( 'This device/bridge is linked to some ecosystem. If it is deleted here, you must manually remove it from your ecosystem!', diff --git a/src/main.ts b/src/main.ts index 21c5644..bff672c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -162,6 +162,10 @@ export class MatterAdapter extends utils.Adapter { }; } + get matterEnvironment(): Environment { + return this.#matterEnvironment; + } + async shutDownMatterNodes(): Promise { for (const { device } of this.#devices.values()) { await device?.destroy(); @@ -1085,7 +1089,6 @@ export class MatterAdapter extends utils.Adapter { const matterController = new MatterController({ adapter: this, controllerOptions, - matterEnvironment: this.#matterEnvironment, updateCallback: () => this.#refreshControllerDevices(), }); matterController.init(); // add bridge to server diff --git a/src/matter/BridgedDevicesNode.ts b/src/matter/BridgedDevicesNode.ts index ebfa300..6d79568 100644 --- a/src/matter/BridgedDevicesNode.ts +++ b/src/matter/BridgedDevicesNode.ts @@ -201,6 +201,7 @@ class BridgedDevices extends BaseServerNode { NetworkCommissioningServer.withFeatures(NetworkCommissioning.Feature.EthernetNetworkInterface), ), { + environment: this.adapter.matterEnvironment, id: this.#parameters.uuid, network: { port: this.#parameters.port, diff --git a/src/matter/ControllerNode.ts b/src/matter/ControllerNode.ts index 3dd0742..c101da8 100644 --- a/src/matter/ControllerNode.ts +++ b/src/matter/ControllerNode.ts @@ -1,4 +1,4 @@ -import { type Environment, Logger, NodeId, singleton, VendorId, type ServerAddressIp } from '@matter/main'; +import { Logger, NodeId, singleton, VendorId, type ServerAddressIp } from '@matter/main'; import { GeneralCommissioning } from '@matter/main/clusters'; import { Ble, @@ -19,7 +19,6 @@ import { inspect } from 'util'; export interface ControllerCreateOptions { adapter: MatterAdapter; controllerOptions: MatterControllerConfig; - matterEnvironment: Environment; updateCallback: () => void; } @@ -39,7 +38,6 @@ type EndUserCommissioningOptions = ( class Controller implements GeneralNode { #parameters: MatterControllerConfig; readonly #adapter: MatterAdapter; - readonly #matterEnvironment: Environment; readonly #updateCallback: () => void; #commissioningController?: CommissioningController; #nodes = new Map(); @@ -51,7 +49,6 @@ class Controller implements GeneralNode { constructor(options: ControllerCreateOptions) { this.#adapter = options.adapter; this.#parameters = options.controllerOptions; - this.#matterEnvironment = options.matterEnvironment; this.#updateCallback = options.updateCallback; } @@ -244,7 +241,7 @@ class Controller implements GeneralNode { this.#commissioningController = new CommissioningController({ autoConnect: false, environment: { - environment: this.#matterEnvironment, + environment: this.#adapter.matterEnvironment, id: 'controller', }, }); @@ -510,9 +507,9 @@ class Controller implements GeneralNode { } async #discoveryStop(): Promise { - this.#discovering = false; - await this.#adapter.setState('controller.info.discovering', false, true); if (this.#commissioningController && this.#discovering) { + this.#discovering = false; + await this.#adapter.setState('controller.info.discovering', false, true); this.#adapter.log.info(`Stop the discovering...`); this.#commissioningController.cancelCommissionableDeviceDiscovery( {}, diff --git a/src/matter/DeviceNode.ts b/src/matter/DeviceNode.ts index 6ee3a86..344d8b9 100644 --- a/src/matter/DeviceNode.ts +++ b/src/matter/DeviceNode.ts @@ -100,6 +100,7 @@ class Device extends BaseServerNode { NetworkCommissioningServer.withFeatures(NetworkCommissioning.Feature.EthernetNetworkInterface), ), { + environment: this.adapter.matterEnvironment, id: this.#parameters.uuid, network: { port: this.#parameters.port, diff --git a/src/matter/to-iobroker/GenericDeviceToIoBroker.ts b/src/matter/to-iobroker/GenericDeviceToIoBroker.ts index c9ab5db..dac2a87 100644 --- a/src/matter/to-iobroker/GenericDeviceToIoBroker.ts +++ b/src/matter/to-iobroker/GenericDeviceToIoBroker.ts @@ -612,7 +612,7 @@ export abstract class GenericDeviceToIoBroker { const voltage = await powerSource.getBatVoltageAttribute(); const percentRemaining = await powerSource.getBatPercentRemainingAttribute(); if (typeof voltage === 'number') { - states.batteryVoltage = `${(voltage / 1_000).toFixed(2)} V${typeof percentRemaining === 'number' ? ` (${percentRemaining}%)` : ''}`; + states.batteryVoltage = `${(voltage / 1_000).toFixed(2)} V${typeof percentRemaining === 'number' ? ` (${Math.round(percentRemaining / 2)}%)` : ''}`; } else if (typeof percentRemaining === 'number') { states.batteryVoltage = `${Math.round(percentRemaining / 2)}%`; }