diff --git a/docs/getting-started/migrating-to-v8.md b/docs/getting-started/migrating-to-v8.md index f2392dfa0cb0..0c2f513958bf 100644 --- a/docs/getting-started/migrating-to-v8.md +++ b/docs/getting-started/migrating-to-v8.md @@ -49,3 +49,7 @@ interface ZWaveOptions { }; } ``` + +## Removed `neighbors` property from `ZWaveNode` class and removed `InterviewStage.Neighbors` + +The static `neighbors` property was deprecated in `v7.9.0` and is now removed. Use `controller.getNodeNeighbors` to retrieve the neighbor lists on demand instead of accessing stale data. Furthermore, the interview stage `Neighbors` was removed too, because the information is no longer stored. diff --git a/packages/zwave-js/src/lib/node/Node.test.ts b/packages/zwave-js/src/lib/node/Node.test.ts index 29365faf30d3..d315edadaae5 100644 --- a/packages/zwave-js/src/lib/node/Node.test.ts +++ b/packages/zwave-js/src/lib/node/Node.test.ts @@ -53,24 +53,12 @@ class TestNode extends ZWaveNode { public async interviewCCs(): Promise { return super.interviewCCs(); } - // public async queryManufacturerSpecific(): Promise { - // return super.queryManufacturerSpecific(); - // } - // public async queryCCVersions(): Promise { - // return super.queryCCVersions(); - // } // public async queryEndpoints(): Promise { // return super.queryEndpoints(); // } // public async configureWakeup(): Promise { // return super.configureWakeup(); // } - // public async requestStaticValues(): Promise { - // return super.requestStaticValues(); - // } - public async queryNeighbors(): Promise { - return super["queryNeighbors"](); - } public get implementedCommandClasses(): Map< CommandClasses, CommandClassInfo @@ -512,7 +500,6 @@ describe("lib/node/Node", () => { queryProtocolInfo: InterviewStage.ProtocolInfo, queryNodeInfo: InterviewStage.NodeInfo, interviewCCs: InterviewStage.CommandClasses, - queryNeighbors: InterviewStage.Neighbors, }; const returnValues: Partial> = { ping: true, @@ -522,7 +509,6 @@ describe("lib/node/Node", () => { queryProtocolInfo: node["queryProtocolInfo"].bind(node), queryNodeInfo: node["queryNodeInfo"].bind(node), interviewCCs: node["interviewCCs"].bind(node), - queryNeighbors: node["queryNeighbors"].bind(node), }; for (const method of Object.keys( originalMethods, @@ -979,7 +965,6 @@ describe("lib/node/Node", () => { supportsBeaming: true, protocolVersion: 3, nodeType: "Controller", - neighbors: [2, 3, 4], commandClasses: { "0x25": { name: "Binary Switch", @@ -1098,11 +1083,11 @@ describe("lib/node/Node", () => { it("deserialize() should also accept numbers for the interview stage", () => { const input = { ...serializedTestNode, - interviewStage: InterviewStage.Neighbors, + interviewStage: InterviewStage.Complete, }; const node = new ZWaveNode(1, fakeDriver); node.deserialize(input); - expect(node.interviewStage).toBe(InterviewStage.Neighbors); + expect(node.interviewStage).toBe(InterviewStage.Complete); node.destroy(); }); diff --git a/packages/zwave-js/src/lib/node/Node.ts b/packages/zwave-js/src/lib/node/Node.ts index db8ca6fe199b..ad99115a544b 100644 --- a/packages/zwave-js/src/lib/node/Node.ts +++ b/packages/zwave-js/src/lib/node/Node.ts @@ -14,7 +14,6 @@ import { getCCName, isTransmissionError, isZWaveError, - MAX_NODES, Maybe, MetadataUpdatedArgs, NodeUpdatePayload, @@ -623,15 +622,6 @@ export class ZWaveNode extends Endpoint { } } - private _neighbors: readonly number[] = []; - /** - * The IDs of all direct neighbors of this node - * @deprecated Request the current known neighbors using `controller.getNodeNeighbors` instead. - */ - public get neighbors(): readonly number[] { - return this._neighbors; - } - private _valueDB: ValueDB; /** * Provides access to this node's values @@ -1121,7 +1111,6 @@ export class ZWaveNode extends Endpoint { this._supportsSecurity = undefined; this._supportsBeaming = undefined; this._deviceConfig = undefined; - this._neighbors = []; this._hasEmittedNoNetworkKeyError = false; this._valueDB.clear({ noEvent: true }); this._endpointInstances.clear(); @@ -1229,14 +1218,6 @@ export class ZWaveNode extends Endpoint { await this.overwriteConfig(); } - if (this.interviewStage === InterviewStage.OverwriteConfig) { - // Request a list of this node's neighbors - // wotan-disable-next-line no-unstable-api-use - if (!(await tryInterviewStage(() => this.queryNeighbors()))) { - return false; - } - } - await this.setInterviewStage(InterviewStage.Complete); this.readyMachine.send("INTERVIEW_DONE"); @@ -1955,17 +1936,6 @@ protocol version: ${this._protocolVersion}`; await this.setInterviewStage(InterviewStage.OverwriteConfig); } - /** - * Queries the controller for a node's neighbor nodes during the node interview - * @deprecated This should be done on demand, not once - */ - protected async queryNeighbors(): Promise { - this._neighbors = await this.driver.controller.getNodeNeighbors( - this.id, - ); - await this.setInterviewStage(InterviewStage.Neighbors); - } - /** * @internal * Handles a CommandClass that was received from this node @@ -3277,7 +3247,6 @@ protocol version: ${this._protocolVersion}`; generic: this.deviceClass.generic.key, specific: this.deviceClass.specific.key, }, - neighbors: [...this._neighbors].sort(), isListening: this.isListening, isFrequentListening: this.isFrequentListening, isRouting: this.isRouting, @@ -3398,13 +3367,6 @@ protocol version: ${this._protocolVersion}`; this._supportedDataRates = obj.supportedDataRates; } - if (isArray(obj.neighbors)) { - // parse only valid node IDs - this._neighbors = obj.neighbors.filter( - (n: any) => typeof n === "number" && n > 0 && n <= MAX_NODES, - ); - } - function enforceType( val: any, type: "boolean" | "number" | "string", diff --git a/packages/zwave-js/src/lib/node/Types.ts b/packages/zwave-js/src/lib/node/Types.ts index b67935bd6863..d487646b1a53 100644 --- a/packages/zwave-js/src/lib/node/Types.ts +++ b/packages/zwave-js/src/lib/node/Types.ts @@ -133,9 +133,6 @@ export enum InterviewStage { */ OverwriteConfig, - /** The node has been queried for its current neighbor list */ - Neighbors, - /** The interview process has finished */ Complete, }