-
-
Notifications
You must be signed in to change notification settings - Fork 630
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: ensure that an unsolicited NIF causes re-interview to start
- Loading branch information
Showing
4 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/zwave-js/src/lib/test/compat/fixtures/reInterviewWakeUpNIF/7e570001.jsonl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{"k":"cacheFormat","v":1} | ||
{"k":"node.1.isListening","v":true} | ||
{"k":"node.1.isFrequentListening","v":false} | ||
{"k":"node.1.isRouting","v":true} | ||
{"k":"node.1.supportedDataRates","v":[40000,9600,100000]} | ||
{"k":"node.1.protocolVersion","v":3} | ||
{"k":"node.1.nodeType","v":"Controller"} | ||
{"k":"node.1.supportsSecurity","v":false} | ||
{"k":"node.1.supportsBeaming","v":true} | ||
{"k":"node.1.deviceClass","v":{"basic":2,"generic":2,"specific":7}} | ||
{"k":"node.1.endpoint.0.commandClass.0x72","v":{"isSupported":true,"isControlled":false,"secure":false,"version":0}} | ||
{"k":"node.1.endpoint.0.commandClass.0x86","v":{"isSupported":true,"isControlled":false,"secure":false,"version":0}} | ||
{"k":"node.1.endpoint.0.commandClass.0x20","v":{"isSupported":false,"isControlled":true,"secure":false,"version":0}} | ||
{"k":"node.1.endpoint.0.commandClass.0x60","v":{"isSupported":false,"isControlled":true,"secure":false,"version":0}} | ||
{"k":"node.1.interviewStage","v":"Complete"} | ||
|
||
|
||
{"k":"node.2.isListening","v":false} | ||
{"k":"node.2.isFrequentListening","v":false} | ||
{"k":"node.2.isRouting","v":true} | ||
{"k":"node.2.supportedDataRates","v":[40000,9600,100000]} | ||
{"k":"node.2.protocolVersion","v":3} | ||
{"k":"node.2.nodeType","v":"End Node"} | ||
{"k":"node.2.supportsSecurity","v":false} | ||
{"k":"node.2.supportsBeaming","v":true} | ||
{"k":"node.2.deviceClass","v":{"basic":4,"generic":6,"specific":1}} | ||
// Version CC | ||
{"k":"node.2.endpoint.0.commandClass.0x86","v":{"isSupported":true,"isControlled":false,"secure":false,"version":1}} | ||
// Wake Up CC | ||
{"k":"node.2.endpoint.0.commandClass.0x84","v":{"isSupported":true,"isControlled":false,"secure":false,"version":3}} | ||
|
||
{"k":"node.2.securityClasses.S2_AccessControl","v":false} | ||
{"k":"node.2.securityClasses.S2_Authenticated","v":false} | ||
{"k":"node.2.securityClasses.S2_Unauthenticated","v":false} | ||
{"k":"node.2.securityClasses.S0_Legacy","v":false} | ||
{"k":"node.2.interviewStage","v":"Complete"} | ||
{"k":"node.2.hasSUCReturnRoute","v":true} |
54 changes: 54 additions & 0 deletions
54
packages/zwave-js/src/lib/test/compat/reInterviewWakeUpNIF.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { ZWaveProtocolCCNodeInformationFrame } from "@zwave-js/cc"; | ||
import { CommandClasses } from "@zwave-js/core"; | ||
import { createMockZWaveRequestFrame } from "@zwave-js/testing"; | ||
import { wait } from "alcalzone-shared/async"; | ||
import path from "node:path"; | ||
import { integrationTest } from "../integrationTestSuite"; | ||
|
||
integrationTest( | ||
"Re-interviews that wait for a wake-up start when receiving a NIF", | ||
{ | ||
// debug: true, | ||
|
||
provisioningDirectory: path.join( | ||
__dirname, | ||
"fixtures/reInterviewWakeUpNIF", | ||
), | ||
|
||
nodeCapabilities: { | ||
isFrequentListening: false, | ||
isListening: false, | ||
|
||
commandClasses: [ | ||
CommandClasses["Wake Up"], | ||
CommandClasses.Version, | ||
], | ||
}, | ||
|
||
async testBody(t, driver, node, mockController, mockNode) { | ||
const promise = node.refreshInfo(); | ||
|
||
await wait(500); | ||
|
||
// Send a NIF to trigger the re-interview | ||
const cc = new ZWaveProtocolCCNodeInformationFrame(mockNode.host, { | ||
nodeId: mockNode.id, | ||
...mockNode.capabilities, | ||
supportedCCs: [...mockNode.implementedCCs] | ||
.filter(([, info]) => info.isSupported) | ||
.map(([ccId]) => ccId), | ||
}); | ||
await mockNode.sendToController( | ||
createMockZWaveRequestFrame(cc, { | ||
ackRequested: false, | ||
}), | ||
); | ||
|
||
// The interview should now happen | ||
await promise; | ||
|
||
await wait(500); | ||
t.pass(); | ||
}, | ||
}, | ||
); |