From b3981fa467642123ef44ded660a808988a3c0f1f Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Mon, 14 Oct 2024 13:54:46 +0200 Subject: [PATCH] refactor: pass ownNodeId where required --- packages/cc/src/cc/Security2CC.ts | 28 ++++++++--- packages/cc/src/cc/SecurityCC.ts | 16 +++++- packages/host/src/ZWaveHost.ts | 2 +- packages/host/src/mocks.ts | 6 +-- packages/testing/src/MockController.ts | 26 +++------- packages/testing/src/MockNode.ts | 3 +- .../zwave-js/src/lib/controller/Controller.ts | 1 + .../lib/controller/MockControllerBehaviors.ts | 18 +++---- packages/zwave-js/src/lib/driver/Driver.ts | 15 +++++- .../src/lib/driver/MessageGenerators.ts | 7 ++- .../src/lib/node/MockNodeBehaviors.ts | 14 ++++-- .../src/lib/node/mockCCBehaviors/Basic.ts | 2 +- .../lib/node/mockCCBehaviors/BinarySensor.ts | 4 +- .../lib/node/mockCCBehaviors/BinarySwitch.ts | 2 +- .../lib/node/mockCCBehaviors/ColorSwitch.ts | 4 +- .../lib/node/mockCCBehaviors/Configuration.ts | 10 ++-- .../node/mockCCBehaviors/EnergyProduction.ts | 2 +- .../src/lib/node/mockCCBehaviors/Meter.ts | 4 +- .../lib/node/mockCCBehaviors/MultiChannel.ts | 6 +-- .../node/mockCCBehaviors/MultilevelSensor.ts | 6 +-- .../node/mockCCBehaviors/MultilevelSwitch.ts | 4 +- .../lib/node/mockCCBehaviors/Notification.ts | 4 +- .../node/mockCCBehaviors/ScheduleEntryLock.ts | 10 ++-- .../lib/node/mockCCBehaviors/SoundSwitch.ts | 10 ++-- .../node/mockCCBehaviors/ThermostatMode.ts | 4 +- .../node/mockCCBehaviors/ThermostatSetback.ts | 2 +- .../mockCCBehaviors/ThermostatSetpoint.ts | 10 ++-- .../src/lib/node/mockCCBehaviors/UserCode.ts | 14 +++--- .../node/mockCCBehaviors/WindowCovering.ts | 2 +- .../BridgeApplicationCommandRequest.ts | 6 ++- .../network-mgmt/SetSUCNodeIDMessages.ts | 10 ++-- .../transport/SendDataBridgeMessages.ts | 8 +-- .../discardUnsupportedReports.test.ts | 12 ++--- .../mapNotificationDoorLock.test.ts | 4 +- .../cc-specific/notificationEnums.test.ts | 42 ++++++++-------- .../notificationIdleManually.test.ts | 8 +-- .../notificationIdleRelated.test.ts | 4 +- .../cc-specific/undefinedTargetValue.test.ts | 2 +- .../cc-specific/unknownNotifications.test.ts | 2 +- .../zwave-js/src/lib/test/cc/WakeUpCC.test.ts | 1 + ...rySensorReportAnyUseFirstSupported.test.ts | 2 +- .../invalidCallbackFunctionTypes.test.ts | 4 +- .../test/compliance/decodeLowerS2Keys.test.ts | 17 ++++--- .../discardInsecureCommands.test.ts | 15 +++--- .../encapsulationAnswerAsAsked.test.ts | 8 +-- .../handleMultiCommandPayload.test.ts | 4 +- .../secureNodeSecureEndpoint.test.ts | 22 ++++++--- .../test/driver/assemblePartialCCs.test.ts | 3 ++ .../driver/computeNetCCPayloadSize.test.ts | 2 + .../createCCValuesUsingKnownVersion.test.ts | 2 +- .../driver/handleNonImplementedCCs.test.ts | 2 +- ...noreCCVersion0ForKnownSupportedCCs.test.ts | 32 +++++++----- .../multiStageResponseNoTimeout.test.ts | 12 ++--- .../driver/nodeAsleepBlockNonceReport.test.ts | 10 ++-- .../driver/nodeAsleepMessageOrder.test.ts | 4 +- .../test/driver/notificationPushNoAGI.test.ts | 2 +- .../driver/reInterviewAssumeAwake.test.ts | 4 +- .../test/driver/s0AndS2Encapsulation.test.ts | 19 ++++--- .../lib/test/driver/s0Encapsulation.test.ts | 16 +++--- .../driver/s0EncapsulationTwoNodes.test.ts | 18 ++++--- .../src/lib/test/driver/s2Collisions.test.ts | 49 ++++++++++++------- .../setValueFailedSupervisionGet.test.ts | 4 +- .../test/driver/setValueNoSupervision.test.ts | 2 +- .../setValueSucceedAfterFailure.test.ts | 4 +- ...setValueSuccessfulSupervisionNoGet.test.ts | 2 +- .../driver/setValueSupervision255Get.test.ts | 8 +-- ...ValueSupervisionSuccessMoreUpdates.test.ts | 2 +- .../driver/setValueSupervisionWorking.test.ts | 4 +- .../driver/targetValueVersionUnknown.test.ts | 4 +- .../src/lib/test/driver/unknownValues.test.ts | 12 ++--- .../lib/test/driver/unresponsiveStick.test.ts | 2 +- .../legacyRefreshActuatorSensorCCs.test.ts | 2 +- 72 files changed, 357 insertions(+), 271 deletions(-) diff --git a/packages/cc/src/cc/Security2CC.ts b/packages/cc/src/cc/Security2CC.ts index 570fdefc6d2f..1a7f1426d655 100644 --- a/packages/cc/src/cc/Security2CC.ts +++ b/packages/cc/src/cc/Security2CC.ts @@ -212,6 +212,7 @@ export class Security2CCAPI extends CCAPI { const cc = new Security2CCNonceReport(this.applHost, { nodeId: this.endpoint.nodeId, + ownNodeId: this.applHost.ownNodeId, endpoint: this.endpoint.index, securityManagers: this.applHost, SOS: true, @@ -259,6 +260,7 @@ export class Security2CCAPI extends CCAPI { const cc = new Security2CCNonceReport(this.applHost, { nodeId: this.endpoint.nodeId, + ownNodeId: this.applHost.ownNodeId, endpoint: this.endpoint.index, securityManagers: this.applHost, SOS: false, @@ -303,6 +305,7 @@ export class Security2CCAPI extends CCAPI { const cc = new Security2CCMessageEncapsulation(this.applHost, { nodeId: this.endpoint.nodeId, + ownNodeId: this.applHost.ownNodeId, endpoint: this.endpoint.index, securityManagers: this.applHost, extensions: [ @@ -368,6 +371,7 @@ export class Security2CCAPI extends CCAPI { cc = Security2CC.encapsulate( this.applHost, cc, + this.applHost.ownNodeId, this.applHost, { securityClass }, ); @@ -612,13 +616,16 @@ export class Security2CC extends CommandClass { protected assertSecurity( options: - | (CCCommandOptions & { securityManagers: SecurityManagers }) + | (CCCommandOptions & { + ownNodeId: number; + securityManagers: SecurityManagers; + }) | CommandClassDeserializationOptions, ): SecurityManager2 { const verb = gotDeserializationOptions(options) ? "decoded" : "sent"; const ownNodeId = gotDeserializationOptions(options) ? options.context.ownNodeId - : this.host.ownNodeId; + : options.ownNodeId; if (!ownNodeId) { throw new ZWaveError( `Secure commands (S2) can only be ${verb} when the controller's node id is known!`, @@ -945,6 +952,7 @@ export class Security2CC extends CommandClass { public static encapsulate( host: ZWaveHost, cc: CommandClass, + ownNodeId: number, securityManagers: SecurityManagers, options?: { securityClass?: SecurityClass; @@ -979,6 +987,7 @@ export class Security2CC extends CommandClass { const ret = new Security2CCMessageEncapsulation(host, { nodeId, + ownNodeId, encapsulated: cc, securityManagers, securityClass: options?.securityClass, @@ -999,6 +1008,7 @@ export class Security2CC extends CommandClass { export interface Security2CCMessageEncapsulationOptions extends CCCommandOptions { + ownNodeId: number; securityManagers: Readonly; /** Can be used to override the default security class for the command */ securityClass?: SecurityClass; @@ -1247,8 +1257,8 @@ export class Security2CCMessageEncapsulation extends Security2CC { const authData = getAuthenticationData( sendingNodeId, - this.getDestinationIDRX(), - this.host.homeId, + this.getDestinationIDRX(options.context.ownNodeId), + options.context.homeId, messageLength, unencryptedPayload, ); @@ -1486,8 +1496,8 @@ export class Security2CCMessageEncapsulation extends Security2CC { return ret; } - private getDestinationIDRX(): number { - if (this.isSinglecast()) return this.host.ownNodeId; + private getDestinationIDRX(ownNodeId: number): number { + if (this.isSinglecast()) return ownNodeId; const ret = this.getMulticastGroupId(); if (ret == undefined) { @@ -1956,7 +1966,10 @@ export class Security2CCMessageEncapsulation extends Security2CC { // @publicAPI export type Security2CCNonceReportOptions = - & { securityManagers: SecurityManagers } + & { + ownNodeId: number; + securityManagers: SecurityManagers; + } & ( | { MOS: boolean; @@ -2067,6 +2080,7 @@ export class Security2CCNonceReport extends Security2CC { // @publicAPI export interface Security2CCNonceGetOptions { + ownNodeId: number; securityManagers: Readonly; } diff --git a/packages/cc/src/cc/SecurityCC.ts b/packages/cc/src/cc/SecurityCC.ts index 5b79992c24f1..2b1d2eac4ed2 100644 --- a/packages/cc/src/cc/SecurityCC.ts +++ b/packages/cc/src/cc/SecurityCC.ts @@ -117,6 +117,7 @@ export class SecurityCCAPI extends PhysicalCCAPI { : SecurityCCCommandEncapsulation )(this.applHost, { nodeId: this.endpoint.nodeId, + ownNodeId: this.applHost.ownNodeId, securityManager: this.applHost.securityManager!, encapsulated, }); @@ -237,6 +238,7 @@ export class SecurityCCAPI extends PhysicalCCAPI { cc = new SecurityCCCommandEncapsulation(this.applHost, { nodeId: this.endpoint.nodeId, endpoint: this.endpoint.index, + ownNodeId: this.applHost.ownNodeId, securityManager: this.applHost.securityManager!, encapsulated: cc, }); @@ -272,6 +274,7 @@ export class SecurityCCAPI extends PhysicalCCAPI { const cc = new SecurityCCCommandEncapsulation(this.applHost, { nodeId: this.endpoint.nodeId, endpoint: this.endpoint.index, + ownNodeId: this.applHost.ownNodeId, securityManager: this.applHost.securityManager!, encapsulated: keySet, alternativeNetworkKey: Buffer.alloc(16, 0), @@ -342,11 +345,17 @@ export class SecurityCC extends CommandClass { protected assertSecurity( options: - | (CCCommandOptions & { securityManager: SecurityManager }) + | (CCCommandOptions & { + ownNodeId: number; + securityManager: SecurityManager; + }) | CommandClassDeserializationOptions, ): SecurityManager { const verb = gotDeserializationOptions(options) ? "decoded" : "sent"; - if (!this.host.ownNodeId) { + const ownNodeId = gotDeserializationOptions(options) + ? options.context.ownNodeId + : options.ownNodeId; + if (!ownNodeId) { throw new ZWaveError( `Secure commands (S0) can only be ${verb} when the controller's node id is known!`, ZWaveErrorCodes.Driver_NotReady, @@ -529,12 +538,14 @@ export class SecurityCC extends CommandClass { /** Encapsulates a command that should be sent encrypted */ public static encapsulate( host: ZWaveHost, + ownNodeId: number, securityManager: SecurityManager, cc: CommandClass, ): SecurityCCCommandEncapsulation { // TODO: When to return a SecurityCCCommandEncapsulationNonceGet? const ret = new SecurityCCCommandEncapsulation(host, { nodeId: cc.nodeId, + ownNodeId, securityManager, encapsulated: cc, }); @@ -600,6 +611,7 @@ export class SecurityCCNonceGet extends SecurityCC {} export interface SecurityCCCommandEncapsulationOptions extends CCCommandOptions { + ownNodeId: number; securityManager: SecurityManager; encapsulated: CommandClass; alternativeNetworkKey?: Buffer; diff --git a/packages/host/src/ZWaveHost.ts b/packages/host/src/ZWaveHost.ts index d52683ac5ad1..c2bbf99d9f41 100644 --- a/packages/host/src/ZWaveHost.ts +++ b/packages/host/src/ZWaveHost.ts @@ -82,7 +82,7 @@ export interface CCEncodingContext } /** Host application abstractions to be used in Serial API and CC implementations */ -export interface ZWaveHost extends HostIDs { +export interface ZWaveHost { /** * Retrieves the maximum version of a command class that can be used to communicate with a node. * Returns 1 if the node claims that it does not support a CC. diff --git a/packages/host/src/mocks.ts b/packages/host/src/mocks.ts index 9ded504db6dd..765c493a8a65 100644 --- a/packages/host/src/mocks.ts +++ b/packages/host/src/mocks.ts @@ -13,11 +13,9 @@ import { ZWaveErrorCodes, } from "@zwave-js/core"; import { createThrowingMap } from "@zwave-js/shared"; -import type { ZWaveApplicationHost, ZWaveHost } from "./ZWaveHost"; +import type { HostIDs, ZWaveApplicationHost, ZWaveHost } from "./ZWaveHost"; -export interface CreateTestingHostOptions { - homeId: ZWaveHost["homeId"]; - ownNodeId: ZWaveHost["ownNodeId"]; +export interface CreateTestingHostOptions extends HostIDs { getSafeCCVersion: ZWaveHost["getSafeCCVersion"]; getSupportedCCVersion?: ZWaveHost["getSupportedCCVersion"]; } diff --git a/packages/testing/src/MockController.ts b/packages/testing/src/MockController.ts index 2e29e222fa8f..13e0d4e439b6 100644 --- a/packages/testing/src/MockController.ts +++ b/packages/testing/src/MockController.ts @@ -61,10 +61,10 @@ export class MockController { // const valueDBCache = new Map(); // const supervisionSessionIDs = new Map number>(); + this.ownNodeId = options.ownNodeId ?? 1; + this.homeId = options.homeId ?? 0x7e571000; + this.host = { - ownNodeId: options.ownNodeId ?? 1, - homeId: options.homeId ?? 0x7e571000, - // nodes: this.nodes as any, getSafeCCVersion: () => 100, getSupportedCCVersion: (cc, nodeId, endpointIndex = 0) => { if (!this.nodes.has(nodeId)) { @@ -75,19 +75,6 @@ export class MockController { return (endpoint ?? node).implementedCCs.get(cc)?.version ?? 0; }, isCCSecure: () => false, - // getValueDB: (nodeId) => { - // if (!valueDBCache.has(nodeId)) { - // valueDBCache.set( - // nodeId, - // new ValueDB( - // nodeId, - // valuesStorage as any, - // metadataStorage as any, - // ), - // ); - // } - // return valueDBCache.get(nodeId)!; - // }, }; this.capabilities = { @@ -97,8 +84,8 @@ export class MockController { const securityClasses = new Map>(); this.encodingContext = { - homeId: this.host.homeId, - ownNodeId: this.host.ownNodeId, + homeId: this.homeId, + ownNodeId: this.ownNodeId, // TODO: LR is not supported in mocks nodeIdType: NodeIDType.Short, hasSecurityClass( @@ -142,6 +129,9 @@ export class MockController { void this.execute(); } + public homeId: number; + public ownNodeId: number; + public securityManagers: SecurityManagers = {}; public encodingContext: MessageEncodingContext; diff --git a/packages/testing/src/MockNode.ts b/packages/testing/src/MockNode.ts index 2a48d34632ce..d7bc77c83284 100644 --- a/packages/testing/src/MockNode.ts +++ b/packages/testing/src/MockNode.ts @@ -115,7 +115,6 @@ export class MockNode { // A node's host is a bit more specialized than the controller's host. this.host = { ...this.controller.host, - ownNodeId: this.id, __internalIsMockNode: true, // // Mimic the behavior of ZWaveNode, but for arbitrary node IDs }; @@ -123,7 +122,7 @@ export class MockNode { const securityClasses = new Map>(); this.encodingContext = { - homeId: this.controller.host.homeId, + homeId: this.controller.homeId, ownNodeId: this.id, hasSecurityClass( nodeId: number, diff --git a/packages/zwave-js/src/lib/controller/Controller.ts b/packages/zwave-js/src/lib/controller/Controller.ts index 1df131eb36df..3b12c50f38bd 100644 --- a/packages/zwave-js/src/lib/controller/Controller.ts +++ b/packages/zwave-js/src/lib/controller/Controller.ts @@ -5112,6 +5112,7 @@ export class ZWaveController Message & SuccessIndicator >( new SetSUCNodeIdRequest(this.driver, { + ownNodeId: this.ownNodeId!, sucNodeId: nodeId, enableSUC, enableSIS, diff --git a/packages/zwave-js/src/lib/controller/MockControllerBehaviors.ts b/packages/zwave-js/src/lib/controller/MockControllerBehaviors.ts index d95ea008f385..ecd8219717be 100644 --- a/packages/zwave-js/src/lib/controller/MockControllerBehaviors.ts +++ b/packages/zwave-js/src/lib/controller/MockControllerBehaviors.ts @@ -94,7 +94,7 @@ function createLazySendDataPayload( return () => { try { const cmd = CommandClass.from(node.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, data: msg.payload, origin: MessageOrigin.Host, context: { @@ -113,7 +113,7 @@ function createLazySendDataPayload( // The whole CC is not implemented yet. If this happens in tests, it is because we sent a raw CC. try { const cmd = new CommandClass(host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, ccId: msg.payload[0], ccCommand: msg.payload[1], payload: msg.payload.subarray(2), @@ -145,8 +145,8 @@ const respondToGetControllerId: MockControllerBehavior = { async onHostMessage(host, controller, msg) { if (msg instanceof GetControllerIdRequest) { const ret = new GetControllerIdResponse(host, { - homeId: host.homeId, - ownNodeId: host.ownNodeId, + homeId: controller.homeId, + ownNodeId: controller.ownNodeId, }); await controller.sendMessageToHost(ret); return true; @@ -194,7 +194,7 @@ const respondToGetSUCNodeId: MockControllerBehavior = { async onHostMessage(host, controller, msg) { if (msg instanceof GetSUCNodeIdRequest) { const sucNodeId = controller.capabilities.isStaticUpdateController - ? host.ownNodeId + ? controller.ownNodeId : controller.capabilities.sucNodeId; const ret = new GetSUCNodeIdResponse(host, { sucNodeId, @@ -209,7 +209,7 @@ const respondToGetSerialApiInitData: MockControllerBehavior = { async onHostMessage(host, controller, msg) { if (msg instanceof GetSerialApiInitDataRequest) { const nodeIds = new Set(controller.nodes.keys()); - nodeIds.add(host.ownNodeId); + nodeIds.add(controller.ownNodeId); const ret = new GetSerialApiInitDataResponse(host, { zwaveApiVersion: controller.capabilities.zwaveApiVersion, @@ -248,7 +248,7 @@ const respondToSoftReset: MockControllerBehavior = { const respondToGetNodeProtocolInfo: MockControllerBehavior = { async onHostMessage(host, controller, msg) { if (msg instanceof GetNodeProtocolInfoRequest) { - if (msg.requestedNodeId === host.ownNodeId) { + if (msg.requestedNodeId === controller.ownNodeId) { const ret = new GetNodeProtocolInfoResponse(host, { ...determineNIF(), nodeType: NodeType.Controller, @@ -494,7 +494,7 @@ const handleRequestNodeInfo: MockControllerBehavior = { const node = controller.nodes.get(msg.getNodeId()!)!; const command = new ZWaveProtocolCCRequestNodeInformationFrame( node.host, - { nodeId: controller.host.ownNodeId }, + { nodeId: controller.ownNodeId }, ); const frame = createMockZWaveRequestFrame(command, { ackRequested: false, @@ -570,7 +570,7 @@ const handleAssignSUCReturnRoute: MockControllerBehavior = { const node = controller.nodes.get(msg.getNodeId()!)!; const command = new ZWaveProtocolCCAssignSUCReturnRoute(host, { nodeId: node.id, - destinationNodeId: controller.host.ownNodeId, + destinationNodeId: controller.ownNodeId, repeaters: [], // don't care routeIndex: 0, // don't care destinationSpeed: ZWaveDataRate["100k"], diff --git a/packages/zwave-js/src/lib/driver/Driver.ts b/packages/zwave-js/src/lib/driver/Driver.ts index 2fec34c5ff2f..8ba3052a4841 100644 --- a/packages/zwave-js/src/lib/driver/Driver.ts +++ b/packages/zwave-js/src/lib/driver/Driver.ts @@ -5280,6 +5280,7 @@ ${handlers.length} left`, cmd = Security2CC.encapsulate( this, cmd, + this.ownNodeId, this, { securityClass: options.s2OverrideSecurityClass, @@ -5292,7 +5293,12 @@ ${handlers.length} left`, // This check will return false for S2-encapsulated commands if (SecurityCC.requiresEncapsulation(cmd)) { - cmd = SecurityCC.encapsulate(this, this.securityManager!, cmd); + cmd = SecurityCC.encapsulate( + this, + this.ownNodeId, + this.securityManager!, + cmd, + ); } } return cmd; @@ -6115,6 +6121,7 @@ ${handlers.length} left`, ) { // Prioritize Bridge commands when they are supported msg = new SendDataBridgeRequest(this, { + sourceNodeId: this.ownNodeId, command, maxSendAttempts: this._options.attempts.sendData, }); @@ -6132,6 +6139,7 @@ ${handlers.length} left`, ) { // Prioritize Bridge commands when they are supported msg = new SendDataMulticastBridgeRequest(this, { + sourceNodeId: this.ownNodeId, command, maxSendAttempts: this._options.attempts.sendData, }); @@ -6974,7 +6982,10 @@ ${handlers.length} left`, msg = commandOrMsg; } else { const SendDataConstructor = this.getSendDataSinglecastConstructor(); - msg = new SendDataConstructor(this, { command: commandOrMsg }); + msg = new SendDataConstructor(this, { + sourceNodeId: this.ownNodeId, + command: commandOrMsg, + }); } if (!ignoreEncapsulation) { msg.command = this.encapsulateCommands( diff --git a/packages/zwave-js/src/lib/driver/MessageGenerators.ts b/packages/zwave-js/src/lib/driver/MessageGenerators.ts index 5d19c49fbf1a..26c6c3762ad9 100644 --- a/packages/zwave-js/src/lib/driver/MessageGenerators.ts +++ b/packages/zwave-js/src/lib/driver/MessageGenerators.ts @@ -605,6 +605,7 @@ export const secureMessageGeneratorS2: MessageGeneratorImplementation = // No free nonce, request a new one const cc = new Security2CCNonceGet(driver, { nodeId: nodeId, + ownNodeId: driver.ownNodeId, endpoint: msg.command.endpointIndex, securityManagers: driver, }); @@ -835,6 +836,7 @@ export const secureMessageGeneratorS2Multicast: MessageGeneratorImplementation = if (innerMPANState) { const cc = new Security2CCMessageEncapsulation(driver, { nodeId, + ownNodeId: driver.ownNodeId, securityManagers: driver, extensions: [ new MPANExtension({ @@ -902,7 +904,10 @@ export const secureMessageGeneratorS2Multicast: MessageGeneratorImplementation = }); const ret = new (driver.getSendDataSinglecastConstructor())( driver, - { command: cc }, + { + sourceNodeId: driver.ownNodeId, + command: cc, + }, ); return ret; } else { diff --git a/packages/zwave-js/src/lib/node/MockNodeBehaviors.ts b/packages/zwave-js/src/lib/node/MockNodeBehaviors.ts index 0589bd5b173d..42e73826a39b 100644 --- a/packages/zwave-js/src/lib/node/MockNodeBehaviors.ts +++ b/packages/zwave-js/src/lib/node/MockNodeBehaviors.ts @@ -100,7 +100,7 @@ const respondToZWavePlusCCGet: MockNodeBehavior = { handleCC(controller, self, receivedCC) { if (receivedCC instanceof ZWavePlusCCGet) { const cc = new ZWavePlusCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, zwavePlusVersion: 2, nodeType: ZWavePlusNodeType.Node, roleType: self.capabilities.isListening @@ -124,7 +124,7 @@ const respondToS0ZWavePlusCCGet: MockNodeBehavior = { && receivedCC.encapsulated instanceof ZWavePlusCCGet ) { let cc: CommandClass = new ZWavePlusCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, zwavePlusVersion: 2, nodeType: ZWavePlusNodeType.Node, roleType: self.capabilities.isListening @@ -137,6 +137,7 @@ const respondToS0ZWavePlusCCGet: MockNodeBehavior = { }); cc = SecurityCC.encapsulate( self.host, + self.id, self.securityManagers.securityManager!, cc, ); @@ -152,7 +153,7 @@ const respondToS2ZWavePlusCCGet: MockNodeBehavior = { && receivedCC.encapsulated instanceof ZWavePlusCCGet ) { let cc: CommandClass = new ZWavePlusCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, zwavePlusVersion: 2, nodeType: ZWavePlusNodeType.Node, roleType: self.capabilities.isListening @@ -163,7 +164,12 @@ const respondToS2ZWavePlusCCGet: MockNodeBehavior = { installerIcon: 0x0000, userIcon: 0x0000, }); - cc = Security2CC.encapsulate(self.host, cc, self.securityManagers); + cc = Security2CC.encapsulate( + self.host, + cc, + self.id, + self.securityManagers, + ); return { action: "sendCC", cc }; } }, diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/Basic.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/Basic.ts index cccd5e04a575..0f5ab952e176 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/Basic.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/Basic.ts @@ -16,7 +16,7 @@ const respondToBasicGet: MockNodeBehavior = { } const cc = new BasicCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: (self.state.get(StateKeys.currentValue) ?? 0) as number, }); diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/BinarySensor.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/BinarySensor.ts index 93b02bb9d0ed..751d08b98a87 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/BinarySensor.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/BinarySensor.ts @@ -24,7 +24,7 @@ const respondToBinarySensorSupportedGet: MockNodeBehavior = { ), }; const cc = new BinarySensorCCSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedSensorTypes: capabilities.supportedSensorTypes, }); return { action: "sendCC", cc }; @@ -57,7 +57,7 @@ const respondToBinarySensorGet: MockNodeBehavior = { if (sensorType != undefined) { const value = capabilities.getValue?.(sensorType) ?? false; const cc = new BinarySensorCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, type: sensorType, value, }); diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/BinarySwitch.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/BinarySwitch.ts index 416dc35a2e09..a431d87ceab1 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/BinarySwitch.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/BinarySwitch.ts @@ -33,7 +33,7 @@ const respondToBinarySwitchGet: MockNodeBehavior = { ), }; const cc = new BinarySwitchCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: ( self.state.get(StateKeys.currentValue) ?? capabilities.defaultValue diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/ColorSwitch.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/ColorSwitch.ts index ffcbad8ee159..04ab347da8d2 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/ColorSwitch.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/ColorSwitch.ts @@ -36,7 +36,7 @@ const respondToColorSwitchSupportedGet: MockNodeBehavior = { ), }; const cc = new ColorSwitchCCSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedColorComponents: Object.keys( capabilities.colorComponents, ).map( @@ -75,7 +75,7 @@ const respondToColorSwitchGet: MockNodeBehavior = { const component = receivedCC.colorComponent; if (component in capabilities.colorComponents) { const cc = new ColorSwitchCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, colorComponent: component, currentValue: (self.state.get(StateKeys.component(component)) diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/Configuration.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/Configuration.ts index 6fa5b3dc00b7..4a5f0a2665a1 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/Configuration.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/Configuration.ts @@ -51,7 +51,7 @@ const respondToConfigurationGet: MockNodeBehavior = { ?? 0; const cc = new ConfigurationCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, parameter, value, valueSize: paramInfo.valueSize, @@ -138,7 +138,7 @@ const respondToConfigurationNameGet: MockNodeBehavior = { if (!paramInfo) return { action: "fail" }; const cc = new ConfigurationCCNameReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, parameter, name: paramInfo.name ?? "", reportsToFollow: 0, @@ -166,7 +166,7 @@ const respondToConfigurationInfoGet: MockNodeBehavior = { if (!paramInfo) return { action: "fail" }; const cc = new ConfigurationCCInfoReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, parameter, info: paramInfo.info ?? "", reportsToFollow: 0, @@ -198,7 +198,7 @@ const respondToConfigurationPropertiesGet: MockNodeBehavior = { // If the parameter is not supported, respond with the first supported parameter if (!paramInfo) { cc = new ConfigurationCCPropertiesReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, parameter, valueFormat: 0, valueSize: 0, @@ -206,7 +206,7 @@ const respondToConfigurationPropertiesGet: MockNodeBehavior = { }); } else { cc = new ConfigurationCCPropertiesReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, parameter, valueSize: paramInfo.valueSize, valueFormat: paramInfo.format diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/EnergyProduction.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/EnergyProduction.ts index a25b3b9bf62c..acfc5ad840e5 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/EnergyProduction.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/EnergyProduction.ts @@ -53,7 +53,7 @@ const respondToEnergyProductionGet: MockNodeBehavior = { ]; const cc = new EnergyProductionCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, parameter: receivedCC.parameter, value: result?.value ?? 0, scale: getEnergyProductionScale( diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/Meter.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/Meter.ts index b3bb9097d1f9..281a2638fb97 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/Meter.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/Meter.ts @@ -30,7 +30,7 @@ const respondToMeterSupportedGet: MockNodeBehavior = { ), }; const cc = new MeterCCSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, type: capabilities.meterType, supportedScales: capabilities.supportedScales, supportedRateTypes: capabilities.supportedRateTypes, @@ -69,7 +69,7 @@ const respondToMeterGet: MockNodeBehavior = { : value; const cc = new MeterCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, type: capabilities.meterType, scale, rateType, diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/MultiChannel.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/MultiChannel.ts index 1017522d3d84..fc6132e65fab 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/MultiChannel.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/MultiChannel.ts @@ -60,7 +60,7 @@ const respondToMultiChannelCCEndPointGet: MockNodeBehavior = { handleCC(controller, self, receivedCC) { if (receivedCC instanceof MultiChannelCCEndPointGet) { const cc = new MultiChannelCCEndPointReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, countIsDynamic: false, identicalCapabilities: false, individualCount: self.endpoints.size, @@ -75,7 +75,7 @@ const respondToMultiChannelCCEndPointFind: MockNodeBehavior = { if (receivedCC instanceof MultiChannelCCEndPointFind) { const request = receivedCC; const cc = new MultiChannelCCEndPointFindReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, genericClass: request.genericClass, specificClass: request.specificClass, foundEndpoints: [...self.endpoints.keys()], @@ -93,7 +93,7 @@ const respondToMultiChannelCCCapabilityGet: MockNodeBehavior = { receivedCC.requestedEndpoint, )!; const cc = new MultiChannelCCCapabilityReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, endpointIndex: endpoint.index, genericDeviceClass: endpoint?.capabilities.genericDeviceClass ?? self.capabilities.genericDeviceClass, diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/MultilevelSensor.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/MultilevelSensor.ts index 417b16a4dc5f..8a1157757b13 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/MultilevelSensor.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/MultilevelSensor.ts @@ -25,7 +25,7 @@ const respondToMultilevelSensorGetSupportedSensor: MockNodeBehavior = { ), }; const cc = new MultilevelSensorCCSupportedSensorReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedSensorTypes: Object.keys( capabilities.sensors, ).map((t) => parseInt(t)), @@ -49,7 +49,7 @@ const respondToMultilevelSensorGetSupportedScale: MockNodeBehavior = { const supportedScales = capabilities.sensors[sensorType]?.supportedScales ?? []; const cc = new MultilevelSensorCCSupportedScaleReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sensorType, supportedScales, }); @@ -80,7 +80,7 @@ const respondToMultilevelSensorGet: MockNodeBehavior = { ?? 0; const value = capabilities.getValue?.(sensorType, scale) ?? 0; const cc = new MultilevelSensorCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, type: sensorType, scale, value, diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/MultilevelSwitch.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/MultilevelSwitch.ts index 09bbc13d794a..075f33238104 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/MultilevelSwitch.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/MultilevelSwitch.ts @@ -44,7 +44,7 @@ const respondToMultilevelSwitchGet: MockNodeBehavior = { ?? UNKNOWN_STATE ) as MaybeUnknown; const cc = new MultilevelSwitchCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue, // We don't support transitioning yet targetValue: currentValue, @@ -74,7 +74,7 @@ const respondToMultilevelSwitchSupportedGet: MockNodeBehavior = { ), }; const cc = new MultilevelSwitchCCSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, switchType: capabilities.primarySwitchType, }); return { action: "sendCC", cc }; diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/Notification.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/Notification.ts index 6a723b81025a..561697580ea0 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/Notification.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/Notification.ts @@ -24,7 +24,7 @@ const respondToNotificationSupportedGet: MockNodeBehavior = { ), }; const cc = new NotificationCCSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportsV1Alarm: capabilities.supportsV1Alarm, supportedNotificationTypes: Object.keys( capabilities.notificationTypesAndEvents, @@ -50,7 +50,7 @@ const respondToNotificationEventSupportedGet: MockNodeBehavior = { in capabilities.notificationTypesAndEvents ) { const cc = new NotificationCCEventSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, notificationType: receivedCC.notificationType, supportedEvents: capabilities.notificationTypesAndEvents[ receivedCC.notificationType diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/ScheduleEntryLock.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/ScheduleEntryLock.ts index 70aa3181fc58..8995a3788bea 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/ScheduleEntryLock.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/ScheduleEntryLock.ts @@ -59,7 +59,7 @@ const respondToScheduleEntryLockSupportedGet: MockNodeBehavior = { ), }; const cc = new ScheduleEntryLockCCSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, ...capabilities, }); return { action: "sendCC", cc }; @@ -84,7 +84,7 @@ const respondToScheduleEntryLockTimeOffsetGet: MockNodeBehavior = { handleCC(controller, self, receivedCC) { if (receivedCC instanceof ScheduleEntryLockCCTimeOffsetGet) { const cc = new ScheduleEntryLockCCTimeOffsetReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, standardOffset: (self.state.get(StateKeys.standardOffset) ?? 0) as number, dstOffset: (self.state.get(StateKeys.dstOffset) ?? 0) as number, @@ -196,7 +196,7 @@ const respondToScheduleEntryLockWeekDayScheduleGet: MockNodeBehavior = { ) ?? {}) as AllOrNone; const cc = new ScheduleEntryLockCCWeekDayScheduleReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, userId, slotId, ...schedule, @@ -295,7 +295,7 @@ const respondToScheduleEntryLockYearDayScheduleGet: MockNodeBehavior = { ) ?? {}) as AllOrNone; const cc = new ScheduleEntryLockCCYearDayScheduleReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, userId, slotId, ...schedule, @@ -397,7 +397,7 @@ const respondToScheduleEntryLockDailyRepeatingScheduleGet: MockNodeBehavior = { const cc = new ScheduleEntryLockCCDailyRepeatingScheduleReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, userId, slotId, ...schedule, diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/SoundSwitch.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/SoundSwitch.ts index ffca6b9a851e..1ffce5eef991 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/SoundSwitch.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/SoundSwitch.ts @@ -48,7 +48,7 @@ const respondToSoundSwitchConfigurationGet: MockNodeBehavior = { ), }; const cc = new SoundSwitchCCConfigurationReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, defaultToneId: (self.state.get(StateKeys.defaultToneId) as number) ?? capabilities.defaultToneId, @@ -88,7 +88,7 @@ const respondToSoundSwitchToneNumberGet: MockNodeBehavior = { ), }; const cc = new SoundSwitchCCTonesNumberReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, toneCount: capabilities.tones.length, }); return { action: "sendCC", cc }; @@ -109,7 +109,7 @@ const respondToSoundSwitchToneInfoGet: MockNodeBehavior = { const tone = capabilities.tones[receivedCC.toneId - 1]; if (tone) { const cc = new SoundSwitchCCToneInfoReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, toneId: receivedCC.toneId, ...tone, }); @@ -179,7 +179,7 @@ const respondToSoundSwitchTonePlaySet: MockNodeBehavior = { const cc = new SoundSwitchCCTonePlayReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, toneId: 0, volume: 0, }, @@ -210,7 +210,7 @@ const respondToSoundSwitchTonePlayGet: MockNodeBehavior = { const cc = new SoundSwitchCCTonePlayReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, toneId: currentState?.toneId ?? 0, volume: currentState?.volume ?? 0, }, diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatMode.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatMode.ts index 3bca22f5e634..bac3e9bfb740 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatMode.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatMode.ts @@ -46,7 +46,7 @@ const respondToThermostatModeGet: MockNodeBehavior = { : undefined; const cc = new ThermostatModeCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, mode, // @ts-expect-error I know... manufacturerData, @@ -68,7 +68,7 @@ const respondToThermostatModeSupportedGet: MockNodeBehavior = { }; const cc = new ThermostatModeCCSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedModes: capabilities.supportedModes, }); return { action: "sendCC", cc }; diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatSetback.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatSetback.ts index 6abb57ea0a88..1831e75f3c4a 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatSetback.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatSetback.ts @@ -35,7 +35,7 @@ const respondToThermostatSetbackGet: MockNodeBehavior = { ) as SetbackState; const cc = new ThermostatSetbackCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, setbackType, setbackState, }); diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatSetpoint.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatSetpoint.ts index 2209f732c553..36809cef47df 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatSetpoint.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/ThermostatSetpoint.ts @@ -99,14 +99,14 @@ const respondToThermostatSetpointGet: MockNodeBehavior = { let cc: ThermostatSetpointCCReport; if (value !== undefined) { cc = new ThermostatSetpointCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, type: setpointType, value, scale: scale ?? 0, }); } else { cc = new ThermostatSetpointCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, type: ThermostatSetpointType["N/A"], scale: 0, value: 0, @@ -129,7 +129,7 @@ const respondToThermostatSetpointSupportedGet: MockNodeBehavior = { }; const cc = new ThermostatSetpointCCSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedSetpointTypes: Object.keys(capabilities.setpoints).map( (k) => parseInt(k), ), @@ -156,7 +156,7 @@ const respondToThermostatSetpointCapabilitiesGet: MockNodeBehavior = { let cc: ThermostatSetpointCCCapabilitiesReport; if (setpointCaps) { cc = new ThermostatSetpointCCCapabilitiesReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, type: setpointType, minValue: setpointCaps.minValue, maxValue: setpointCaps.maxValue, @@ -165,7 +165,7 @@ const respondToThermostatSetpointCapabilitiesGet: MockNodeBehavior = { }); } else { cc = new ThermostatSetpointCCCapabilitiesReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, type: ThermostatSetpointType["N/A"], minValue: 0, maxValue: 0, diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/UserCode.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/UserCode.ts index 7661f011c99b..f12c9537aec6 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/UserCode.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/UserCode.ts @@ -56,7 +56,7 @@ const respondToUsersNumberGet: MockNodeBehavior = { ), }; const cc = new UserCodeCCUsersNumberReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedUsers: capabilities.numUsers ?? 1, }); return { action: "sendCC", cc }; @@ -78,7 +78,7 @@ const respondToUserGet: MockNodeBehavior = { let cc: UserCodeCCReport; if (capabilities.numUsers >= userId) { cc = new UserCodeCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, userId, userIdStatus: (self.state.get( StateKeys.userIdStatus(userId), @@ -89,7 +89,7 @@ const respondToUserGet: MockNodeBehavior = { }); } else { cc = new UserCodeCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, userId, userIdStatus: UserIDStatus.StatusNotAvailable, }); @@ -138,7 +138,7 @@ const respondToUserCodeCapabilitiesGet: MockNodeBehavior = { ), }; const cc = new UserCodeCCCapabilitiesReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportsAdminCode: capabilities.supportsAdminCode!, supportsAdminCodeDeactivation: capabilities .supportsAdminCodeDeactivation!, @@ -166,7 +166,7 @@ const respondToUserCodeKeypadModeGet: MockNodeBehavior = { ), }; const cc = new UserCodeCCKeypadModeReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, keypadMode: (self.state.get(StateKeys.keypadMode) ?? capabilities.supportedKeypadModes?.[0] ?? KeypadMode.Normal) as KeypadMode, @@ -243,7 +243,7 @@ const respondToUserCodeAdminCodeGet: MockNodeBehavior = { } const cc = new UserCodeCCAdminCodeReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, adminCode: adminCode ?? "", }); return { action: "sendCC", cc }; @@ -290,7 +290,7 @@ const respondToUserCodeUserCodeChecksumGet: MockNodeBehavior = { const checksum = data.length > 0 ? CRC16_CCITT(data) : 0x0000; const cc = new UserCodeCCUserCodeChecksumReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, userCodeChecksum: checksum, }); return { action: "sendCC", cc }; diff --git a/packages/zwave-js/src/lib/node/mockCCBehaviors/WindowCovering.ts b/packages/zwave-js/src/lib/node/mockCCBehaviors/WindowCovering.ts index a72707d27d06..e58846dc4fff 100644 --- a/packages/zwave-js/src/lib/node/mockCCBehaviors/WindowCovering.ts +++ b/packages/zwave-js/src/lib/node/mockCCBehaviors/WindowCovering.ts @@ -23,7 +23,7 @@ const respondToWindowCoveringSupportedGet: MockNodeBehavior = { ), }; const cc = new WindowCoveringCCSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedParameters: capabilities.supportedParameters, }); return { action: "sendCC", cc }; diff --git a/packages/zwave-js/src/lib/serialapi/application/BridgeApplicationCommandRequest.ts b/packages/zwave-js/src/lib/serialapi/application/BridgeApplicationCommandRequest.ts index 7bec31bb0a26..2b11230284e6 100644 --- a/packages/zwave-js/src/lib/serialapi/application/BridgeApplicationCommandRequest.ts +++ b/packages/zwave-js/src/lib/serialapi/application/BridgeApplicationCommandRequest.ts @@ -37,6 +37,8 @@ export class BridgeApplicationCommandRequest extends Message options: MessageDeserializationOptions, ) { super(host, options); + this._ownNodeId = options.ctx.ownNodeId; + // if (gotDeserializationOptions(options)) { // first byte is a status flag const status = this.payload[0]; @@ -110,6 +112,8 @@ export class BridgeApplicationCommandRequest extends Message public readonly fromForeignHomeId: boolean; public readonly rssi?: RSSI; + private _ownNodeId: number; + // This needs to be writable or unwrapping MultiChannelCCs crashes public command: SinglecastCC; // TODO: why is this a SinglecastCC? @@ -125,7 +129,7 @@ export class BridgeApplicationCommandRequest extends Message if (this.frameType !== "singlecast") { message.type = this.frameType; } - if (this.targetNodeId !== this.host.ownNodeId) { + if (this.targetNodeId !== this._ownNodeId) { if (typeof this.targetNodeId === "number") { message["target node"] = this.targetNodeId; } else if (this.targetNodeId.length === 1) { diff --git a/packages/zwave-js/src/lib/serialapi/network-mgmt/SetSUCNodeIDMessages.ts b/packages/zwave-js/src/lib/serialapi/network-mgmt/SetSUCNodeIDMessages.ts index b740f9cd37ac..20d6e581873b 100644 --- a/packages/zwave-js/src/lib/serialapi/network-mgmt/SetSUCNodeIDMessages.ts +++ b/packages/zwave-js/src/lib/serialapi/network-mgmt/SetSUCNodeIDMessages.ts @@ -31,7 +31,8 @@ export enum SetSUCNodeIdStatus { } export interface SetSUCNodeIdRequestOptions extends MessageBaseOptions { - sucNodeId?: number; + ownNodeId: number; + sucNodeId: number; enableSUC: boolean; enableSIS: boolean; transmitOptions?: TransmitOptions; @@ -65,11 +66,12 @@ export class SetSUCNodeIdRequest extends SetSUCNodeIdRequestBase { ZWaveErrorCodes.Deserialization_NotImplemented, ); } else { - this.sucNodeId = options.sucNodeId ?? host.ownNodeId; + this.sucNodeId = options.sucNodeId; this.enableSUC = options.enableSUC; this.enableSIS = options.enableSIS; this.transmitOptions = options.transmitOptions ?? TransmitOptions.DEFAULT; + this._ownNodeId = options.ownNodeId; } } @@ -78,6 +80,8 @@ export class SetSUCNodeIdRequest extends SetSUCNodeIdRequestBase { public enableSIS: boolean; public transmitOptions: TransmitOptions; + private _ownNodeId: number; + public serialize(ctx: MessageEncodingContext): Buffer { this.assertCallbackId(); const nodeId = encodeNodeID(this.sucNodeId, ctx.nodeIdType); @@ -95,7 +99,7 @@ export class SetSUCNodeIdRequest extends SetSUCNodeIdRequestBase { } public expectsCallback(): boolean { - if (this.sucNodeId === this.host.ownNodeId) return false; + if (this.sucNodeId === this._ownNodeId) return false; return super.expectsCallback(); } } diff --git a/packages/zwave-js/src/lib/serialapi/transport/SendDataBridgeMessages.ts b/packages/zwave-js/src/lib/serialapi/transport/SendDataBridgeMessages.ts index eeac3b48923e..c52dd4b459ab 100644 --- a/packages/zwave-js/src/lib/serialapi/transport/SendDataBridgeMessages.ts +++ b/packages/zwave-js/src/lib/serialapi/transport/SendDataBridgeMessages.ts @@ -55,7 +55,7 @@ interface SendDataBridgeRequestOptions< CCType extends CommandClass = CommandClass, > extends MessageBaseOptions { command: CCType; - sourceNodeId?: number; + sourceNodeId: number; transmitOptions?: TransmitOptions; maxSendAttempts?: number; } @@ -79,7 +79,7 @@ export class SendDataBridgeRequest ); } - this.sourceNodeId = options.sourceNodeId ?? host.ownNodeId; + this.sourceNodeId = options.sourceNodeId; this.command = options.command; this.transmitOptions = options.transmitOptions @@ -287,7 +287,7 @@ interface SendDataMulticastBridgeRequestOptions extends MessageBaseOptions { command: CCType; - sourceNodeId?: number; + sourceNodeId: number; transmitOptions?: TransmitOptions; maxSendAttempts?: number; } @@ -320,7 +320,7 @@ export class SendDataMulticastBridgeRequest< ); } - this.sourceNodeId = options.sourceNodeId ?? host.ownNodeId; + this.sourceNodeId = options.sourceNodeId; this.command = options.command; this.transmitOptions = options.transmitOptions ?? TransmitOptions.DEFAULT; diff --git a/packages/zwave-js/src/lib/test/cc-specific/discardUnsupportedReports.test.ts b/packages/zwave-js/src/lib/test/cc-specific/discardUnsupportedReports.test.ts index e1eecc15007a..d67a0d433b97 100644 --- a/packages/zwave-js/src/lib/test/cc-specific/discardUnsupportedReports.test.ts +++ b/packages/zwave-js/src/lib/test/cc-specific/discardUnsupportedReports.test.ts @@ -25,7 +25,7 @@ integrationTest( testBody: async (t, driver, node, mockController, mockNode) => { // Unsupported report from root endpoint let cc: CommandClass = new MultilevelSensorCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, type: 0x01, // Temperature scale: 0x00, // Celsius value: 1.001, @@ -38,13 +38,13 @@ integrationTest( // Report from endpoint 1, unsupported on root cc = new MultilevelSensorCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, type: 0x01, // Temperature scale: 0x00, // Celsius value: 25.12, }); cc = new MultiChannelCCCommandEncapsulation(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, endpoint: 1, destination: 0, encapsulated: cc, @@ -57,13 +57,13 @@ integrationTest( // Unsupported Report from endpoint 1, supported on root cc = new MeterCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, type: 0x01, // Electric scale: 0x00, // kWh value: 1.234, }); cc = new MultiChannelCCCommandEncapsulation(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, endpoint: 1, destination: 0, encapsulated: cc, @@ -76,7 +76,7 @@ integrationTest( // Supported report from root endpoint cc = new MeterCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, type: 0x01, // Electric scale: 0x00, // kWh value: 2.34, diff --git a/packages/zwave-js/src/lib/test/cc-specific/mapNotificationDoorLock.test.ts b/packages/zwave-js/src/lib/test/cc-specific/mapNotificationDoorLock.test.ts index 2828c1904ac6..f8d7f3320652 100644 --- a/packages/zwave-js/src/lib/test/cc-specific/mapNotificationDoorLock.test.ts +++ b/packages/zwave-js/src/lib/test/cc-specific/mapNotificationDoorLock.test.ts @@ -19,7 +19,7 @@ integrationTest( const valueId = DoorLockCCValues.currentMode.id; let cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, // Access Control, notificationEvent: 0x01, // Manual Lock Operation }); @@ -34,7 +34,7 @@ integrationTest( t.is(node.getValue(valueId), DoorLockMode.Secured); cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, // Access Control, notificationEvent: 0x06, // Keypad Unlock Operation }); diff --git a/packages/zwave-js/src/lib/test/cc-specific/notificationEnums.test.ts b/packages/zwave-js/src/lib/test/cc-specific/notificationEnums.test.ts index 6a5f2407b92f..f78f514a8311 100644 --- a/packages/zwave-js/src/lib/test/cc-specific/notificationEnums.test.ts +++ b/packages/zwave-js/src/lib/test/cc-specific/notificationEnums.test.ts @@ -50,7 +50,7 @@ integrationTest( // Send notifications to the node let cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x0f, notificationEvent: 0x01, eventParameters: Buffer.from([0x00]), // Off / Closed @@ -67,7 +67,7 @@ integrationTest( t.is(value, 0x00); cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x0f, notificationEvent: 0x01, eventParameters: Buffer.from([0x01]), // On / Open @@ -125,7 +125,7 @@ integrationTest( // Send notifications to the node let cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, eventParameters: Buffer.from([0x00]), // open in regular position @@ -142,7 +142,7 @@ integrationTest( t.is(value, 0x1600); cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, eventParameters: Buffer.from([0x01]), // open in tilt position @@ -158,7 +158,7 @@ integrationTest( t.is(value, 0x1601); cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, // open }); @@ -173,7 +173,7 @@ integrationTest( t.is(value, 0x16); cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x17, // closed }); @@ -241,7 +241,7 @@ integrationTest("The 'simple' Door state value works correctly", { const valueSimple = NotificationCCValues.doorStateSimple; let cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, // Window/door is open eventParameters: Buffer.from([0x01]), // ... in tilt position @@ -260,7 +260,7 @@ integrationTest("The 'simple' Door state value works correctly", { // === cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, // Window/door is open eventParameters: Buffer.from([0x00]), // ... in regular position @@ -279,7 +279,7 @@ integrationTest("The 'simple' Door state value works correctly", { // === cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, // Window/door is open }); @@ -297,7 +297,7 @@ integrationTest("The 'simple' Door state value works correctly", { // === cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x17, // Window/door is closed }); @@ -347,7 +347,7 @@ integrationTest("The synthetic 'Door tilt state' value works correctly", { // Send a notification to the node where the window is not tilted let cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, // Window/door is open eventParameters: Buffer.from([0x00]), // ... in regular position @@ -367,7 +367,7 @@ integrationTest("The synthetic 'Door tilt state' value works correctly", { // Again with tilt cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, // Window/door is open eventParameters: Buffer.from([0x01]), // ... in tilt position @@ -388,7 +388,7 @@ integrationTest("The synthetic 'Door tilt state' value works correctly", { // Again without tilt cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, // Window/door is open eventParameters: Buffer.from([0x00]), // ... in regular position @@ -407,7 +407,7 @@ integrationTest("The synthetic 'Door tilt state' value works correctly", { // Again with tilt to be able to detect changes cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, // Window/door is open eventParameters: Buffer.from([0x01]), // ... in tilt position @@ -426,7 +426,7 @@ integrationTest("The synthetic 'Door tilt state' value works correctly", { // And now without the enum cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x17, // Window/door is closed }); @@ -444,7 +444,7 @@ integrationTest("The synthetic 'Door tilt state' value works correctly", { // Again with tilt to be able to detect changes cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, // Window/door is open eventParameters: Buffer.from([0x01]), // ... in tilt position @@ -463,7 +463,7 @@ integrationTest("The synthetic 'Door tilt state' value works correctly", { // And again without the enum cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, notificationEvent: 0x16, // Window/door is open }); @@ -521,7 +521,7 @@ integrationTest( // Send notifications to the node let cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x05, notificationEvent: 0x07, eventParameters: Buffer.from([0x02]), // Below low threshold @@ -539,7 +539,7 @@ integrationTest( // Now send one without an event parameter cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x05, notificationEvent: 0x07, }); @@ -554,7 +554,7 @@ integrationTest( t.is(value, 0x01); // cc = new NotificationCCReport(mockNode.host, { - // nodeId: mockController.host.ownNodeId, + // nodeId: mockController.ownNodeId, // notificationType: 0x06, // notificationEvent: 0x16, // open // }); @@ -569,7 +569,7 @@ integrationTest( // t.is(value, 0x16); // cc = new NotificationCCReport(mockNode.host, { - // nodeId: mockController.host.ownNodeId, + // nodeId: mockController.ownNodeId, // notificationType: 0x06, // notificationEvent: 0x17, // closed // }); diff --git a/packages/zwave-js/src/lib/test/cc-specific/notificationIdleManually.test.ts b/packages/zwave-js/src/lib/test/cc-specific/notificationIdleManually.test.ts index 27bb94b6bfd1..35f73d45cfa8 100644 --- a/packages/zwave-js/src/lib/test/cc-specific/notificationIdleManually.test.ts +++ b/packages/zwave-js/src/lib/test/cc-specific/notificationIdleManually.test.ts @@ -18,7 +18,7 @@ integrationTest("Notification values can get idled manually", { ).id; let cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x01, // Smoke Alarm notificationEvent: 0x03, // Smoke alarm test }); @@ -47,7 +47,7 @@ integrationTest("Notification values can get idled manually", { ).id; cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, // Access Control notificationEvent: 0x16, // Door state }); @@ -81,7 +81,7 @@ integrationTest( ).id; let cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x01, // Smoke Alarm notificationEvent: 0x03, // Smoke alarm test }); @@ -109,7 +109,7 @@ integrationTest( ).id; cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, // Access Control notificationEvent: 0x16, // Door state }); diff --git a/packages/zwave-js/src/lib/test/cc-specific/notificationIdleRelated.test.ts b/packages/zwave-js/src/lib/test/cc-specific/notificationIdleRelated.test.ts index 31e5fc7f94fb..3b5c77ffc139 100644 --- a/packages/zwave-js/src/lib/test/cc-specific/notificationIdleRelated.test.ts +++ b/packages/zwave-js/src/lib/test/cc-specific/notificationIdleRelated.test.ts @@ -23,7 +23,7 @@ integrationTest( ).id; let cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, // Access Control, notificationEvent: 0x0b, // Lock jammed }); @@ -38,7 +38,7 @@ integrationTest( t.is(node.getValue(lockStateValueId), 0x0b /* Lock jammed */); cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, // Access Control, notificationEvent: 0x06, // Keypad Unlock Operation }); diff --git a/packages/zwave-js/src/lib/test/cc-specific/undefinedTargetValue.test.ts b/packages/zwave-js/src/lib/test/cc-specific/undefinedTargetValue.test.ts index 77b2cabd358b..9077749337ad 100644 --- a/packages/zwave-js/src/lib/test/cc-specific/undefinedTargetValue.test.ts +++ b/packages/zwave-js/src/lib/test/cc-specific/undefinedTargetValue.test.ts @@ -19,7 +19,7 @@ integrationTest( node.valueDB.setValue(targetValueValueID, false); const cc = new BinarySwitchCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: true, }); await mockNode.sendToController( diff --git a/packages/zwave-js/src/lib/test/cc-specific/unknownNotifications.test.ts b/packages/zwave-js/src/lib/test/cc-specific/unknownNotifications.test.ts index 82c6a4857b7b..4926670410fc 100644 --- a/packages/zwave-js/src/lib/test/cc-specific/unknownNotifications.test.ts +++ b/packages/zwave-js/src/lib/test/cc-specific/unknownNotifications.test.ts @@ -19,7 +19,7 @@ integrationTest( testBody: async (t, driver, node, mockController, mockNode) => { const cc = new NotificationCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, notificationType: 0x06, // Access Control, notificationEvent: 0xfd, // Manual Lock Operation }); diff --git a/packages/zwave-js/src/lib/test/cc/WakeUpCC.test.ts b/packages/zwave-js/src/lib/test/cc/WakeUpCC.test.ts index ec097feedd1a..02be66cedd84 100644 --- a/packages/zwave-js/src/lib/test/cc/WakeUpCC.test.ts +++ b/packages/zwave-js/src/lib/test/cc/WakeUpCC.test.ts @@ -43,6 +43,7 @@ test("SecurityCC/WakeUpCCNoMoreInformation should expect NO response", (t) => { const ccRequest = SecurityCC.encapsulate( host, + host.ownNodeId, securityManager as any, new WakeUpCCNoMoreInformation(host, { nodeId: 2, diff --git a/packages/zwave-js/src/lib/test/compat/binarySensorReportAnyUseFirstSupported.test.ts b/packages/zwave-js/src/lib/test/compat/binarySensorReportAnyUseFirstSupported.test.ts index 063e5f569ba6..6ea72a92123b 100644 --- a/packages/zwave-js/src/lib/test/compat/binarySensorReportAnyUseFirstSupported.test.ts +++ b/packages/zwave-js/src/lib/test/compat/binarySensorReportAnyUseFirstSupported.test.ts @@ -40,7 +40,7 @@ integrationTest( // Incorrectly respond with 0xFF as the sensor type const cc = new BinarySensorCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, type: BinarySensorType.Any, value: true, }); diff --git a/packages/zwave-js/src/lib/test/compat/invalidCallbackFunctionTypes.test.ts b/packages/zwave-js/src/lib/test/compat/invalidCallbackFunctionTypes.test.ts index dee44fb2ef58..ef03665fe741 100644 --- a/packages/zwave-js/src/lib/test/compat/invalidCallbackFunctionTypes.test.ts +++ b/packages/zwave-js/src/lib/test/compat/invalidCallbackFunctionTypes.test.ts @@ -73,7 +73,7 @@ integrationTest( host, { nodeId: node.id, - destinationNodeId: controller.host.ownNodeId, + destinationNodeId: controller.ownNodeId, repeaters: [], // don't care routeIndex: 0, // don't care destinationSpeed: ZWaveDataRate["100k"], @@ -163,7 +163,7 @@ integrationTest( host, { nodeId: node.id, - destinationNodeId: controller.host.ownNodeId, + destinationNodeId: controller.ownNodeId, repeaters: [], // don't care routeIndex: 0, // don't care destinationSpeed: ZWaveDataRate["100k"], diff --git a/packages/zwave-js/src/lib/test/compliance/decodeLowerS2Keys.test.ts b/packages/zwave-js/src/lib/test/compliance/decodeLowerS2Keys.test.ts index 6c4309fe816d..b7f2867a0fd8 100644 --- a/packages/zwave-js/src/lib/test/compliance/decodeLowerS2Keys.test.ts +++ b/packages/zwave-js/src/lib/test/compliance/decodeLowerS2Keys.test.ts @@ -77,10 +77,11 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof Security2CCNonceGet) { const nonce = sm2Node.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -101,7 +102,7 @@ integrationTest( receiverEI: controllerEI, }); mockNode.securityManagers.securityManager2!.setSPANState( - mockController.host.ownNodeId, + mockController.ownNodeId, { type: SPANState.RemoteEI, receiverEI: controllerEI, @@ -110,10 +111,11 @@ integrationTest( // The node sends an S2-encapsulated command, but with a lower security class than expected let innerCC: CommandClass = new TimeCCTimeGet(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }); let cc = new Security2CCMessageEncapsulation(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, + ownNodeId: mockNode.id, encapsulated: innerCC, securityManagers: mockNode.securityManagers, }); @@ -152,11 +154,12 @@ integrationTest( // Now the node queries our securely supported commands innerCC = new Security2CCCommandsSupportedGet(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }); cc = new Security2CCMessageEncapsulation(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, + ownNodeId: mockNode.id, encapsulated: innerCC, securityManagers: mockNode.securityManagers, }); diff --git a/packages/zwave-js/src/lib/test/compliance/discardInsecureCommands.test.ts b/packages/zwave-js/src/lib/test/compliance/discardInsecureCommands.test.ts index b2c99abb29b6..151ba627d994 100644 --- a/packages/zwave-js/src/lib/test/compliance/discardInsecureCommands.test.ts +++ b/packages/zwave-js/src/lib/test/compliance/discardInsecureCommands.test.ts @@ -73,10 +73,11 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof Security2CCNonceGet) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -99,10 +100,11 @@ integrationTest( === ZWaveErrorCodes.Security2CC_NoSPAN ) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -128,9 +130,10 @@ integrationTest( let nodeToHost: CommandClass = Security2CC.encapsulate( mockNode.host, new BasicCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: 99, }), + mockNode.id, mockNode.securityManagers, ); await mockNode.sendToController( @@ -147,7 +150,7 @@ integrationTest( // Then send an unencypted one that should be discarded nodeToHost = new BasicCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: 1, }); diff --git a/packages/zwave-js/src/lib/test/compliance/encapsulationAnswerAsAsked.test.ts b/packages/zwave-js/src/lib/test/compliance/encapsulationAnswerAsAsked.test.ts index 3463762265f6..113c2b26faf0 100644 --- a/packages/zwave-js/src/lib/test/compliance/encapsulationAnswerAsAsked.test.ts +++ b/packages/zwave-js/src/lib/test/compliance/encapsulationAnswerAsAsked.test.ts @@ -42,7 +42,7 @@ integrationTest( // We know that the driver must respond to Z-Wave Plus Info Get // so we can use that to test const zwpRequest = new ZWavePlusCCGet(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }); const cc = CRC16CC.encapsulate(mockNode.host, zwpRequest); await mockNode.sendToController(createMockZWaveRequestFrame(cc)); @@ -89,7 +89,7 @@ integrationTest( // We know that the driver must respond to Z-Wave Plus Info Get // so we can use that to test const zwpRequest = new ZWavePlusCCGet(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }); const cc = MultiChannelCC.encapsulate(mockNode.host, zwpRequest); (cc as MultiChannelCCCommandEncapsulation).endpointIndex = 2; @@ -139,7 +139,7 @@ integrationTest( testBody: async (t, driver, node, mockController, mockNode) => { const basicReport = new BasicCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: 0, }); const cc = SupervisionCC.encapsulate(mockNode.host, basicReport); @@ -190,7 +190,7 @@ integrationTest( testBody: async (t, driver, node, mockController, mockNode) => { const basicReport = new BasicCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: 0, }); const supervised = SupervisionCC.encapsulate( diff --git a/packages/zwave-js/src/lib/test/compliance/handleMultiCommandPayload.test.ts b/packages/zwave-js/src/lib/test/compliance/handleMultiCommandPayload.test.ts index e2aa64e62b84..5ccefaf26cd4 100644 --- a/packages/zwave-js/src/lib/test/compliance/handleMultiCommandPayload.test.ts +++ b/packages/zwave-js/src/lib/test/compliance/handleMultiCommandPayload.test.ts @@ -32,11 +32,11 @@ integrationTest("All CCs contained in a Multi Command CC are handled", { testBody: async (t, driver, node, mockController, mockNode) => { // This one requires a response const zwpRequest = new ZWavePlusCCGet(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }); // This one updates a value const scaSet = new SceneActivationCCSet(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, sceneId: 7, }); const cc = MultiCommandCC.encapsulate(mockNode.host, [ diff --git a/packages/zwave-js/src/lib/test/compliance/secureNodeSecureEndpoint.test.ts b/packages/zwave-js/src/lib/test/compliance/secureNodeSecureEndpoint.test.ts index b6ad15a97827..6b71f4157d8d 100644 --- a/packages/zwave-js/src/lib/test/compliance/secureNodeSecureEndpoint.test.ts +++ b/packages/zwave-js/src/lib/test/compliance/secureNodeSecureEndpoint.test.ts @@ -124,10 +124,11 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof Security2CCNonceGet) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -150,10 +151,11 @@ integrationTest( === ZWaveErrorCodes.Security2CC_NoSPAN ) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -183,7 +185,7 @@ integrationTest( const cc = Security2CC.encapsulate( self.host, new Security2CCCommandsSupportedReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedCCs: isHighestGranted ? [...mockNode.implementedCCs.entries()] .filter( @@ -197,6 +199,7 @@ integrationTest( .map(([ccId]) => ccId) : [], }), + self.id, self.securityManagers, ); return { action: "sendCC", cc }; @@ -216,11 +219,12 @@ integrationTest( const cc = Security2CC.encapsulate( self.host, new MultiChannelCCEndPointReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, countIsDynamic: false, identicalCapabilities: false, individualCount: self.endpoints.size, }), + self.id, self.securityManagers, ); return { action: "sendCC", cc }; @@ -241,12 +245,13 @@ integrationTest( const cc = Security2CC.encapsulate( self.host, new MultiChannelCCEndPointFindReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, genericClass: request.genericClass, specificClass: request.specificClass, foundEndpoints: [...self.endpoints.keys()], reportsToFollow: 0, }), + self.id, self.securityManagers, ); return { action: "sendCC", cc }; @@ -269,7 +274,7 @@ integrationTest( const cc = Security2CC.encapsulate( self.host, new MultiChannelCCCapabilityReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, endpointIndex: endpoint.index, genericDeviceClass: endpoint?.capabilities.genericDeviceClass @@ -283,6 +288,7 @@ integrationTest( ...endpoint.implementedCCs.keys(), ], }), + self.id, self.securityManagers, ); return { action: "sendCC", cc }; diff --git a/packages/zwave-js/src/lib/test/driver/assemblePartialCCs.test.ts b/packages/zwave-js/src/lib/test/driver/assemblePartialCCs.test.ts index f8e80f92bb93..78494ae333e1 100644 --- a/packages/zwave-js/src/lib/test/driver/assemblePartialCCs.test.ts +++ b/packages/zwave-js/src/lib/test/driver/assemblePartialCCs.test.ts @@ -175,6 +175,7 @@ test.serial("supports nested partial/non-partial CCs", (t) => { const cc1 = new BasicCCSet(driver, { nodeId: 2, targetValue: 25 }); const cc = new SecurityCCCommandEncapsulation(driver, { nodeId: 2, + ownNodeId: driver.ownNodeId, securityManager: driver.securityManager!, encapsulated: {} as any, }); @@ -190,6 +191,7 @@ test.serial("supports nested partial/partial CCs (part 1)", (t) => { const { driver } = t.context; const cc = new SecurityCCCommandEncapsulation(driver, { nodeId: 2, + ownNodeId: driver.ownNodeId, securityManager: driver.securityManager!, encapsulated: {} as any, }); @@ -214,6 +216,7 @@ test.serial("supports nested partial/partial CCs (part 2)", (t) => { const { driver } = t.context; const cc = new SecurityCCCommandEncapsulation(driver, { nodeId: 2, + ownNodeId: driver.ownNodeId, securityManager: driver.securityManager!, encapsulated: {} as any, }); diff --git a/packages/zwave-js/src/lib/test/driver/computeNetCCPayloadSize.test.ts b/packages/zwave-js/src/lib/test/driver/computeNetCCPayloadSize.test.ts index db026916a45b..12d094559ec5 100644 --- a/packages/zwave-js/src/lib/test/driver/computeNetCCPayloadSize.test.ts +++ b/packages/zwave-js/src/lib/test/driver/computeNetCCPayloadSize.test.ts @@ -46,6 +46,7 @@ test("should compute the correct net payload sizes", (t) => { const testMsg1 = new SendDataRequest(driver, { command: new SecurityCCCommandEncapsulation(driver, { nodeId: 2, + ownNodeId: driver.ownNodeId, securityManager: driver.securityManager!, encapsulated: {} as any, }), @@ -62,6 +63,7 @@ test("should compute the correct net payload sizes", (t) => { const testMsg2 = new SendDataRequest(driver, { command: new SecurityCCCommandEncapsulation(driver, { nodeId: 2, + ownNodeId: driver.ownNodeId, securityManager: driver.securityManager!, encapsulated: multiChannelCC, }), diff --git a/packages/zwave-js/src/lib/test/driver/createCCValuesUsingKnownVersion.test.ts b/packages/zwave-js/src/lib/test/driver/createCCValuesUsingKnownVersion.test.ts index e2c657a71e57..4a5d62822cb4 100644 --- a/packages/zwave-js/src/lib/test/driver/createCCValuesUsingKnownVersion.test.ts +++ b/packages/zwave-js/src/lib/test/driver/createCCValuesUsingKnownVersion.test.ts @@ -20,7 +20,7 @@ integrationTest("CC values are created using the known CC version", { testBody: async (t, driver, node, mockController, mockNode) => { const batteryReport = new BatteryCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, isLow: true, }); await mockNode.sendToController( diff --git a/packages/zwave-js/src/lib/test/driver/handleNonImplementedCCs.test.ts b/packages/zwave-js/src/lib/test/driver/handleNonImplementedCCs.test.ts index 610762ea957f..47ba91182e00 100644 --- a/packages/zwave-js/src/lib/test/driver/handleNonImplementedCCs.test.ts +++ b/packages/zwave-js/src/lib/test/driver/handleNonImplementedCCs.test.ts @@ -23,7 +23,7 @@ integrationTest( ); const cc = new CommandClass(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, ccId: CommandClasses["Anti-Theft"], ccCommand: 0x02, // Get payload: Buffer.from([0x00, 0x01]), // Technically invalid diff --git a/packages/zwave-js/src/lib/test/driver/ignoreCCVersion0ForKnownSupportedCCs.test.ts b/packages/zwave-js/src/lib/test/driver/ignoreCCVersion0ForKnownSupportedCCs.test.ts index 7a9128f339fd..5124e74f5e0d 100644 --- a/packages/zwave-js/src/lib/test/driver/ignoreCCVersion0ForKnownSupportedCCs.test.ts +++ b/packages/zwave-js/src/lib/test/driver/ignoreCCVersion0ForKnownSupportedCCs.test.ts @@ -75,10 +75,11 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof Security2CCNonceGet) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -101,10 +102,11 @@ integrationTest( === ZWaveErrorCodes.Security2CC_NoSPAN ) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -131,7 +133,7 @@ integrationTest( new Security2CCCommandsSupportedReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedCCs: [ // The node supports Version CC securely CommandClasses.Version, @@ -141,6 +143,7 @@ integrationTest( cc = Security2CC.encapsulate( self.host, cc, + self.id, self.securityManagers, ); return { action: "sendCC", cc }; @@ -162,7 +165,7 @@ integrationTest( let cc: CommandClass = new VersionCCCommandClassReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, requestedCC: receivedCC.encapsulated.requestedCC, ccVersion: 0, @@ -171,6 +174,7 @@ integrationTest( cc = Security2CC.encapsulate( self.host, cc, + self.id, self.securityManagers, ); return { action: "sendCC", cc }; @@ -209,7 +213,7 @@ integrationTest( // Create a security manager for the controller const sm0Ctrlr = new SecurityManager({ - ownNodeId: controller.host.ownNodeId, + ownNodeId: controller.ownNodeId, networkKey: driver.options.securityKeys!.S0_Legacy!, nonceTimeout: 100000, }); @@ -220,11 +224,11 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof SecurityCCNonceGet) { const nonce = sm0Node.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, 8, ); const cc = new SecurityCCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, nonce, }); return { action: "sendCC", cc }; @@ -241,7 +245,7 @@ integrationTest( instanceof SecurityCCCommandsSupportedGet ) { const nonceGet = new SecurityCCNonceGet(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, }); await self.sendToController( createMockZWaveRequestFrame(nonceGet, { @@ -266,7 +270,7 @@ integrationTest( new SecurityCCCommandsSupportedReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedCCs: [ // The node supports Version CC securely CommandClasses.Version, @@ -276,6 +280,7 @@ integrationTest( ); const cc = SecurityCC.encapsulate( self.host, + self.id, self.securityManagers.securityManager!, response, ); @@ -304,7 +309,7 @@ integrationTest( ) { await wait(100); const nonceGet = new SecurityCCNonceGet(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, }); await self.sendToController( createMockZWaveRequestFrame(nonceGet, { @@ -329,7 +334,7 @@ integrationTest( new VersionCCCommandClassReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, requestedCC: receivedCC.encapsulated.requestedCC, ccVersion: 0, @@ -338,6 +343,7 @@ integrationTest( const cc = SecurityCC.encapsulate( self.host, + self.id, self.securityManagers.securityManager!, response, ); diff --git a/packages/zwave-js/src/lib/test/driver/multiStageResponseNoTimeout.test.ts b/packages/zwave-js/src/lib/test/driver/multiStageResponseNoTimeout.test.ts index c835f75e5036..5b45f9ef9859 100644 --- a/packages/zwave-js/src/lib/test/driver/multiStageResponseNoTimeout.test.ts +++ b/packages/zwave-js/src/lib/test/driver/multiStageResponseNoTimeout.test.ts @@ -38,7 +38,7 @@ integrationTest( if (receivedCC instanceof ConfigurationCCNameGet) { await wait(700); let cc = new ConfigurationCCNameReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, parameter: receivedCC.parameter, name: "Test para", reportsToFollow: 1, @@ -52,7 +52,7 @@ integrationTest( await wait(700); cc = new ConfigurationCCNameReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, parameter: receivedCC.parameter, name: "meter", reportsToFollow: 0, @@ -103,7 +103,7 @@ integrationTest( const configCC = new ConfigurationCCNameReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, parameter: receivedCC.parameter, name: "Veeeeeeeeeeeeeeeeeeeeeeeeery loooooooooooooooooong parameter name", @@ -122,7 +122,7 @@ integrationTest( const tsFS = new TransportServiceCCFirstSegment( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId, datagramSize: serialized.length, partialDatagram: segment1, @@ -131,7 +131,7 @@ integrationTest( const tsSS = new TransportServiceCCSubsequentSegment( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId, datagramSize: serialized.length, datagramOffset: segment1.length, @@ -186,7 +186,7 @@ integrationTest("GET requests DO time out if there's no matching response", { if (receivedCC instanceof ConfigurationCCNameGet) { // This is not the response you're looking for const cc = new BasicCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: 1, }); return { action: "sendCC", cc }; diff --git a/packages/zwave-js/src/lib/test/driver/nodeAsleepBlockNonceReport.test.ts b/packages/zwave-js/src/lib/test/driver/nodeAsleepBlockNonceReport.test.ts index 609a43751e99..8d5c8c740bd3 100644 --- a/packages/zwave-js/src/lib/test/driver/nodeAsleepBlockNonceReport.test.ts +++ b/packages/zwave-js/src/lib/test/driver/nodeAsleepBlockNonceReport.test.ts @@ -35,7 +35,7 @@ integrationTest( // Create a security manager for the controller const sm0Ctrlr = new SecurityManager({ - ownNodeId: controller.host.ownNodeId, + ownNodeId: controller.ownNodeId, networkKey: driver.options.securityKeys!.S0_Legacy!, nonceTimeout: 100000, }); @@ -46,11 +46,11 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof SecurityCCNonceGet) { const nonce = sm0Node.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, 8, ); const cc = new SecurityCCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, nonce, }); return { action: "sendCC", cc }; @@ -86,7 +86,7 @@ integrationTest( mockNode.autoAckControllerFrames = false; let nonceRequest = new SecurityCCNonceGet(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }); await mockNode.sendToController( createMockZWaveRequestFrame(nonceRequest, { @@ -124,7 +124,7 @@ integrationTest( // And subsequent requests must be answered nonceRequest = new SecurityCCNonceGet(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }); await mockNode.sendToController( createMockZWaveRequestFrame(nonceRequest, { diff --git a/packages/zwave-js/src/lib/test/driver/nodeAsleepMessageOrder.test.ts b/packages/zwave-js/src/lib/test/driver/nodeAsleepMessageOrder.test.ts index 412b62834e73..2612e9463eae 100644 --- a/packages/zwave-js/src/lib/test/driver/nodeAsleepMessageOrder.test.ts +++ b/packages/zwave-js/src/lib/test/driver/nodeAsleepMessageOrder.test.ts @@ -174,7 +174,7 @@ integrationTest( const cc: CommandClass = new WakeUpCCWakeUpNotification( mockNode10.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }, ); mockNode10.sendToController(createMockZWaveRequestFrame(cc, { @@ -309,7 +309,7 @@ integrationTest( const cc: CommandClass = new WakeUpCCWakeUpNotification( mockNode10.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }, ); mockNode10.sendToController(createMockZWaveRequestFrame(cc, { diff --git a/packages/zwave-js/src/lib/test/driver/notificationPushNoAGI.test.ts b/packages/zwave-js/src/lib/test/driver/notificationPushNoAGI.test.ts index 6c93deb2f757..8c3655868a75 100644 --- a/packages/zwave-js/src/lib/test/driver/notificationPushNoAGI.test.ts +++ b/packages/zwave-js/src/lib/test/driver/notificationPushNoAGI.test.ts @@ -36,7 +36,7 @@ integrationTest( const notificationType = receivedCC.notificationType || 0x06; const cc = new NotificationCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, notificationType, notificationEvent: notificationType === 0x06 ? 0x06 /* Keypad unlock */ diff --git a/packages/zwave-js/src/lib/test/driver/reInterviewAssumeAwake.test.ts b/packages/zwave-js/src/lib/test/driver/reInterviewAssumeAwake.test.ts index 476b895f32a3..5c8b1d94c5f7 100644 --- a/packages/zwave-js/src/lib/test/driver/reInterviewAssumeAwake.test.ts +++ b/packages/zwave-js/src/lib/test/driver/reInterviewAssumeAwake.test.ts @@ -26,7 +26,7 @@ integrationTest("Assume a node to be awake at the start of a re-interview", { // Send a WakeUpNotification to the node to trigger the interview const cc = new WakeUpCCWakeUpNotification(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }); await mockNode.sendToController( createMockZWaveRequestFrame(cc, { @@ -48,7 +48,7 @@ integrationTest("Assume a node to be awake at the start of a re-interview", { }); const cc = new WakeUpCCWakeUpNotification(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }); await mockNode.sendToController( createMockZWaveRequestFrame(cc, { diff --git a/packages/zwave-js/src/lib/test/driver/s0AndS2Encapsulation.test.ts b/packages/zwave-js/src/lib/test/driver/s0AndS2Encapsulation.test.ts index 1a1d7d816152..0815debba5ad 100644 --- a/packages/zwave-js/src/lib/test/driver/s0AndS2Encapsulation.test.ts +++ b/packages/zwave-js/src/lib/test/driver/s0AndS2Encapsulation.test.ts @@ -81,7 +81,7 @@ integrationTest("S0 commands are S0-encapsulated, even when S2 is supported", { () => SecurityClass.S2_Unauthenticated; const sm0Ctrlr = new SecurityManager({ - ownNodeId: controller.host.ownNodeId, + ownNodeId: controller.ownNodeId, networkKey: driver.options.securityKeys!.S0_Legacy!, nonceTimeout: 100000, }); @@ -92,11 +92,11 @@ integrationTest("S0 commands are S0-encapsulated, even when S2 is supported", { handleCC(controller, self, receivedCC) { if (receivedCC instanceof SecurityCCNonceGet) { const nonce = sm0Node.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, 8, ); const cc = new SecurityCCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, nonce, }); return { action: "sendCC", cc }; @@ -122,10 +122,11 @@ integrationTest("S0 commands are S0-encapsulated, even when S2 is supported", { handleCC(controller, self, receivedCC) { if (receivedCC instanceof Security2CCNonceGet) { const nonce = sm2Node.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -148,10 +149,11 @@ integrationTest("S0 commands are S0-encapsulated, even when S2 is supported", { === ZWaveErrorCodes.Security2CC_NoSPAN ) { const nonce = sm2Node.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -172,7 +174,7 @@ integrationTest("S0 commands are S0-encapsulated, even when S2 is supported", { && receivedCC.encapsulated instanceof SupervisionCCGet ) { let cc: CommandClass = new SupervisionCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.encapsulated.sessionId, moreUpdatesFollow: false, status: SupervisionStatus.Success, @@ -180,6 +182,7 @@ integrationTest("S0 commands are S0-encapsulated, even when S2 is supported", { cc = Security2CC.encapsulate( self.host, cc, + self.id, self.securityManagers, ); return { action: "sendCC", cc }; diff --git a/packages/zwave-js/src/lib/test/driver/s0Encapsulation.test.ts b/packages/zwave-js/src/lib/test/driver/s0Encapsulation.test.ts index 2a2beb460f22..ef746bf84148 100644 --- a/packages/zwave-js/src/lib/test/driver/s0Encapsulation.test.ts +++ b/packages/zwave-js/src/lib/test/driver/s0Encapsulation.test.ts @@ -35,7 +35,7 @@ integrationTest("Communication via Security S0 works", { // Create a security manager for the controller const sm0Ctrlr = new SecurityManager({ - ownNodeId: controller.host.ownNodeId, + ownNodeId: controller.ownNodeId, networkKey: driver.options.securityKeys!.S0_Legacy!, nonceTimeout: 100000, }); @@ -46,11 +46,11 @@ integrationTest("Communication via Security S0 works", { handleCC(controller, self, receivedCC) { if (receivedCC instanceof SecurityCCNonceGet) { const nonce = sm0Node.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, 8, ); const cc = new SecurityCCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, nonce, }); return { action: "sendCC", cc }; @@ -68,7 +68,7 @@ integrationTest("Communication via Security S0 works", { instanceof SecurityCCCommandsSupportedGet ) { const nonceGet = new SecurityCCNonceGet(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, }); await self.sendToController( createMockZWaveRequestFrame(nonceGet, { @@ -91,13 +91,14 @@ integrationTest("Communication via Security S0 works", { const response = new SecurityCCCommandsSupportedReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedCCs: [CommandClasses.Basic], controlledCCs: [], }, ); const cc = SecurityCC.encapsulate( self.host, + self.id, self.securityManagers.securityManager!, response, ); @@ -124,7 +125,7 @@ integrationTest("Communication via Security S0 works", { && receivedCC.encapsulated instanceof BasicCCGet ) { const nonceGet = new SecurityCCNonceGet(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, }); await self.sendToController( createMockZWaveRequestFrame(nonceGet, { @@ -145,11 +146,12 @@ integrationTest("Communication via Security S0 works", { const receiverNonce = nonceReport.payload.nonce; const response = new BasicCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: ++queryCount, }); const cc = SecurityCC.encapsulate( self.host, + self.id, self.securityManagers.securityManager!, response, ); diff --git a/packages/zwave-js/src/lib/test/driver/s0EncapsulationTwoNodes.test.ts b/packages/zwave-js/src/lib/test/driver/s0EncapsulationTwoNodes.test.ts index ee4c54b8d1a9..4a54fa3a7762 100644 --- a/packages/zwave-js/src/lib/test/driver/s0EncapsulationTwoNodes.test.ts +++ b/packages/zwave-js/src/lib/test/driver/s0EncapsulationTwoNodes.test.ts @@ -56,7 +56,7 @@ integrationTest( // Create a security manager for the controller const sm0Ctrlr = new SecurityManager({ - ownNodeId: controller.host.ownNodeId, + ownNodeId: controller.ownNodeId, networkKey: driver.options.securityKeys!.S0_Legacy!, nonceTimeout: 100000, }); @@ -67,11 +67,11 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof SecurityCCNonceGet) { const nonce = sm0Node.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, 8, ); const cc = new SecurityCCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, nonce, }); return { action: "sendCC", cc }; @@ -89,7 +89,7 @@ integrationTest( instanceof SecurityCCCommandsSupportedGet ) { const nonceGet = new SecurityCCNonceGet(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, }); await self.sendToController( createMockZWaveRequestFrame(nonceGet, { @@ -116,13 +116,14 @@ integrationTest( new SecurityCCCommandsSupportedReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, supportedCCs: [CommandClasses.Basic], controlledCCs: [], }, ); const cc = SecurityCC.encapsulate( self.host, + self.id, self.securityManagers.securityManager!, response, ); @@ -156,7 +157,7 @@ integrationTest( } const nonceGet = new SecurityCCNonceGet(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, }); await self.sendToController( createMockZWaveRequestFrame(nonceGet, { @@ -180,11 +181,12 @@ integrationTest( const receiverNonce = nonceReport.payload.nonce; const response = new BasicCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: queryCount, }); const cc = SecurityCC.encapsulate( self.host, + self.id, self.securityManagers.securityManager!, response, ); @@ -236,7 +238,7 @@ integrationTest( // Now send a Nonce Get from node 3, which must be answered immediately const nonceGet = new SecurityCCNonceGet(mockNode3.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, }); await mockNode3.sendToController( createMockZWaveRequestFrame(nonceGet, { diff --git a/packages/zwave-js/src/lib/test/driver/s2Collisions.test.ts b/packages/zwave-js/src/lib/test/driver/s2Collisions.test.ts index ff95961456db..2dd4c0a3e4a4 100644 --- a/packages/zwave-js/src/lib/test/driver/s2Collisions.test.ts +++ b/packages/zwave-js/src/lib/test/driver/s2Collisions.test.ts @@ -85,10 +85,11 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof Security2CCNonceGet) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -111,10 +112,11 @@ integrationTest( === ZWaveErrorCodes.Security2CC_NoSPAN ) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -139,7 +141,7 @@ integrationTest( let cc: CommandClass = new SupervisionCCReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.encapsulated.sessionId, moreUpdatesFollow: false, status: SupervisionStatus.Success, @@ -148,6 +150,7 @@ integrationTest( cc = Security2CC.encapsulate( self.host, cc, + self.id, self.securityManagers, ); return { action: "sendCC", cc }; @@ -171,9 +174,10 @@ integrationTest( const nodeToHost = Security2CC.encapsulate( mockNode.host, new BinarySwitchCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: true, }), + mockNode.id, mockNode.securityManagers, ); const p1 = mockNode.sendToController( @@ -258,10 +262,11 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof Security2CCNonceGet) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -284,10 +289,11 @@ integrationTest( === ZWaveErrorCodes.Security2CC_NoSPAN ) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -315,9 +321,10 @@ integrationTest( const nodeToHost = Security2CC.encapsulate( mockNode.host, new BasicCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: 99, }), + mockNode.id, mockNode.securityManagers, ); const p1 = mockNode.sendToController( @@ -395,10 +402,11 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof Security2CCNonceGet) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -421,10 +429,11 @@ integrationTest( === ZWaveErrorCodes.Security2CC_NoSPAN ) { const nonce = smNode.generateNonce( - controller.host.ownNodeId, + controller.ownNodeId, ); const cc = new Security2CCNonceReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, + ownNodeId: self.id, securityManagers: self.securityManagers, SOS: true, MOS: false, @@ -449,7 +458,7 @@ integrationTest( let cc: CommandClass = new SupervisionCCReport( self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.encapsulated.sessionId, moreUpdatesFollow: false, status: SupervisionStatus.Success, @@ -458,6 +467,7 @@ integrationTest( cc = Security2CC.encapsulate( self.host, cc, + self.id, self.securityManagers, ); return { action: "sendCC", cc }; @@ -486,7 +496,7 @@ integrationTest( let nodeToHost: CommandClass = new BinarySwitchCCReport( mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: true, }, ); @@ -494,13 +504,14 @@ integrationTest( mockNode.host, nodeToHost, driver.getNextSupervisionSessionId( - mockController.host.ownNodeId, + mockController.ownNodeId, ), false, ); nodeToHost = Security2CC.encapsulate( mockNode.host, nodeToHost, + mockNode.id, mockNode.securityManagers, ); @@ -530,7 +541,7 @@ integrationTest( // const nodeToHost = Security2CC.encapsulate( // mockNode.host, // new BasicCCReport(mockNode.host, { - // nodeId: mockController.host.ownNodeId, + // nodeId: mockController.ownNodeId, // currentValue: 99, // }), // ); diff --git a/packages/zwave-js/src/lib/test/driver/setValueFailedSupervisionGet.test.ts b/packages/zwave-js/src/lib/test/driver/setValueFailedSupervisionGet.test.ts index dcf1e2a39911..c42947f2cb4d 100644 --- a/packages/zwave-js/src/lib/test/driver/setValueFailedSupervisionGet.test.ts +++ b/packages/zwave-js/src/lib/test/driver/setValueFailedSupervisionGet.test.ts @@ -33,7 +33,7 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof SupervisionCCGet) { const cc = new SupervisionCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.sessionId, moreUpdatesFollow: false, status: SupervisionStatus.Fail, @@ -48,7 +48,7 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof BinarySwitchCCGet) { const cc = new BinarySwitchCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: false, }); return { action: "sendCC", cc }; diff --git a/packages/zwave-js/src/lib/test/driver/setValueNoSupervision.test.ts b/packages/zwave-js/src/lib/test/driver/setValueNoSupervision.test.ts index d58686b1606a..a61159b46ade 100644 --- a/packages/zwave-js/src/lib/test/driver/setValueNoSupervision.test.ts +++ b/packages/zwave-js/src/lib/test/driver/setValueNoSupervision.test.ts @@ -30,7 +30,7 @@ integrationTest("setValue without supervision: expect validation GET", { handleCC(controller, self, receivedCC) { if (receivedCC instanceof BinarySwitchCCGet) { const cc = new BinarySwitchCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: false, }); return { action: "sendCC", cc }; diff --git a/packages/zwave-js/src/lib/test/driver/setValueSucceedAfterFailure.test.ts b/packages/zwave-js/src/lib/test/driver/setValueSucceedAfterFailure.test.ts index b917f86bc453..5103ae634f6d 100644 --- a/packages/zwave-js/src/lib/test/driver/setValueSucceedAfterFailure.test.ts +++ b/packages/zwave-js/src/lib/test/driver/setValueSucceedAfterFailure.test.ts @@ -47,11 +47,11 @@ integrationTest( } let cc: CommandClass = new BasicCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: Math.round(Math.random() * 99), }); cc = new MultiChannelCCCommandEncapsulation(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, destination: receivedCC.endpointIndex, endpoint: receivedCC.destination as number, encapsulated: cc, diff --git a/packages/zwave-js/src/lib/test/driver/setValueSuccessfulSupervisionNoGet.test.ts b/packages/zwave-js/src/lib/test/driver/setValueSuccessfulSupervisionNoGet.test.ts index 8feb0bf5a816..b3abc96466ac 100644 --- a/packages/zwave-js/src/lib/test/driver/setValueSuccessfulSupervisionNoGet.test.ts +++ b/packages/zwave-js/src/lib/test/driver/setValueSuccessfulSupervisionNoGet.test.ts @@ -33,7 +33,7 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof SupervisionCCGet) { const cc = new SupervisionCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.sessionId, moreUpdatesFollow: false, status: SupervisionStatus.Success, diff --git a/packages/zwave-js/src/lib/test/driver/setValueSupervision255Get.test.ts b/packages/zwave-js/src/lib/test/driver/setValueSupervision255Get.test.ts index 576d25fe5c99..6c078727c23e 100644 --- a/packages/zwave-js/src/lib/test/driver/setValueSupervision255Get.test.ts +++ b/packages/zwave-js/src/lib/test/driver/setValueSupervision255Get.test.ts @@ -33,7 +33,7 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof SupervisionCCGet) { const cc = new SupervisionCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.sessionId, moreUpdatesFollow: false, status: SupervisionStatus.Success, @@ -55,7 +55,7 @@ integrationTest( ?.toMilliseconds() ) { const cc1 = new SupervisionCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.sessionId, moreUpdatesFollow: true, status: SupervisionStatus.Working, @@ -63,7 +63,7 @@ integrationTest( }); const cc2 = new SupervisionCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.sessionId, moreUpdatesFollow: false, status: SupervisionStatus.Success, @@ -119,7 +119,7 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof MultilevelSwitchCCGet) { const cc = new MultilevelSwitchCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, targetValue: 88, currentValue: 88, }); diff --git a/packages/zwave-js/src/lib/test/driver/setValueSupervisionSuccessMoreUpdates.test.ts b/packages/zwave-js/src/lib/test/driver/setValueSupervisionSuccessMoreUpdates.test.ts index 6dea3ea9684d..563d7da2cc0f 100644 --- a/packages/zwave-js/src/lib/test/driver/setValueSupervisionSuccessMoreUpdates.test.ts +++ b/packages/zwave-js/src/lib/test/driver/setValueSupervisionSuccessMoreUpdates.test.ts @@ -32,7 +32,7 @@ integrationTest( async handleCC(controller, self, receivedCC) { if (receivedCC instanceof SupervisionCCGet) { const cc = new SupervisionCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.sessionId, moreUpdatesFollow: true, // <-- this is the important part status: SupervisionStatus.Success, diff --git a/packages/zwave-js/src/lib/test/driver/setValueSupervisionWorking.test.ts b/packages/zwave-js/src/lib/test/driver/setValueSupervisionWorking.test.ts index 927a6d01ced7..1d433b7284de 100644 --- a/packages/zwave-js/src/lib/test/driver/setValueSupervisionWorking.test.ts +++ b/packages/zwave-js/src/lib/test/driver/setValueSupervisionWorking.test.ts @@ -44,7 +44,7 @@ integrationTest( async handleCC(controller, self, receivedCC) { if (receivedCC instanceof SupervisionCCGet) { let cc = new SupervisionCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.sessionId, moreUpdatesFollow: true, status: SupervisionStatus.Working, @@ -59,7 +59,7 @@ integrationTest( await wait(2000); cc = new SupervisionCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, sessionId: receivedCC.sessionId, moreUpdatesFollow: false, status: SupervisionStatus.Success, diff --git a/packages/zwave-js/src/lib/test/driver/targetValueVersionUnknown.test.ts b/packages/zwave-js/src/lib/test/driver/targetValueVersionUnknown.test.ts index fd296d90b871..82b7d41eacc6 100644 --- a/packages/zwave-js/src/lib/test/driver/targetValueVersionUnknown.test.ts +++ b/packages/zwave-js/src/lib/test/driver/targetValueVersionUnknown.test.ts @@ -38,7 +38,7 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof BinarySwitchCCGet) { const cc = new BinarySwitchCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: true, }); return { action: "sendCC", cc }; @@ -74,7 +74,7 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof BinarySwitchCCGet) { const cc = new BinarySwitchCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: true, }); return { action: "sendCC", cc }; diff --git a/packages/zwave-js/src/lib/test/driver/unknownValues.test.ts b/packages/zwave-js/src/lib/test/driver/unknownValues.test.ts index 4273ae3c9483..12847b6cedb2 100644 --- a/packages/zwave-js/src/lib/test/driver/unknownValues.test.ts +++ b/packages/zwave-js/src/lib/test/driver/unknownValues.test.ts @@ -45,7 +45,7 @@ integrationTest(`Basic Reports with the UNKNOWN state are correctly handled`, { handleCC(controller, self, receivedCC) { if (receivedCC instanceof BasicCCGet) { const cc = new BasicCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, currentValue: 0, targetValue: 0, duration: new Duration(0, "seconds"), @@ -67,7 +67,7 @@ integrationTest(`Basic Reports with the UNKNOWN state are correctly handled`, { // Send an update with UNKNOWN state const cc = new BasicCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: 254, targetValue: 254, duration: Duration.default(), @@ -114,7 +114,7 @@ integrationTest( // Send an initial state let cc = new MultilevelSwitchCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: 0, targetValue: 0, }); @@ -132,7 +132,7 @@ integrationTest( // Send an update with UNKNOWN state cc = new MultilevelSwitchCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: 254, targetValue: 254, }); @@ -186,7 +186,7 @@ integrationTest( // Send an initial state let cc = new BinarySwitchCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: false, targetValue: false, duration: new Duration(0, "seconds"), @@ -205,7 +205,7 @@ integrationTest( // Send an update with UNKNOWN state cc = new BinarySwitchCCReport(mockNode.host, { - nodeId: mockController.host.ownNodeId, + nodeId: mockController.ownNodeId, currentValue: UNKNOWN_STATE, targetValue: UNKNOWN_STATE, duration: Duration.default(), diff --git a/packages/zwave-js/src/lib/test/driver/unresponsiveStick.test.ts b/packages/zwave-js/src/lib/test/driver/unresponsiveStick.test.ts index 340e6b19c18a..6bee1771cc01 100644 --- a/packages/zwave-js/src/lib/test/driver/unresponsiveStick.test.ts +++ b/packages/zwave-js/src/lib/test/driver/unresponsiveStick.test.ts @@ -50,7 +50,7 @@ integrationTest( { supportCheck: false }, ); - t.is(ids.ownNodeId, mockController.host.ownNodeId); + t.is(ids.ownNodeId, mockController.ownNodeId); }, }, ); diff --git a/packages/zwave-js/src/lib/test/node/legacyRefreshActuatorSensorCCs.test.ts b/packages/zwave-js/src/lib/test/node/legacyRefreshActuatorSensorCCs.test.ts index ee69c1b4f7bc..967805cd7a4a 100644 --- a/packages/zwave-js/src/lib/test/node/legacyRefreshActuatorSensorCCs.test.ts +++ b/packages/zwave-js/src/lib/test/node/legacyRefreshActuatorSensorCCs.test.ts @@ -52,7 +52,7 @@ integrationTest( handleCC(controller, self, receivedCC) { if (receivedCC instanceof MultilevelSwitchCCGet) { const cc = new MultilevelSwitchCCReport(self.host, { - nodeId: controller.host.ownNodeId, + nodeId: controller.ownNodeId, targetValue: 88, currentValue: 88, });