-
-
Notifications
You must be signed in to change notification settings - Fork 634
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: expose Basic CC
currentValue
when compat flag says so (#6964)
- Loading branch information
Showing
9 changed files
with
169 additions
and
29 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
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
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
65 changes: 65 additions & 0 deletions
65
packages/zwave-js/src/lib/test/compat/basicCCReportForThermostat.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,65 @@ | ||
import { BasicCCValues } from "@zwave-js/cc"; | ||
import { CommandClasses } from "@zwave-js/core"; | ||
import path from "node:path"; | ||
import { integrationTest } from "../integrationTestSuite"; | ||
|
||
integrationTest( | ||
"A Thermostat with compat flag mapBasicReport=false exposes currentValue", | ||
{ | ||
// debug: true, | ||
|
||
nodeCapabilities: { | ||
manufacturerId: 0xdead, | ||
productType: 0xbeef, | ||
productId: 0xcafe, | ||
|
||
// General Thermostat V2 | ||
genericDeviceClass: 0x08, | ||
specificDeviceClass: 0x06, | ||
commandClasses: [ | ||
CommandClasses["Z-Wave Plus Info"], | ||
// CommandClasses["Multilevel Sensor"], | ||
CommandClasses["Version"], | ||
{ | ||
ccId: CommandClasses["Thermostat Setpoint"], | ||
version: 3, | ||
}, | ||
{ | ||
ccId: CommandClasses["Thermostat Mode"], | ||
version: 3, | ||
}, | ||
CommandClasses["Manufacturer Specific"], | ||
// CommandClasses["Meter"], | ||
{ | ||
ccId: CommandClasses.Basic, | ||
version: 1, | ||
}, | ||
], | ||
}, | ||
|
||
additionalDriverOptions: { | ||
storage: { | ||
deviceConfigPriorityDir: path.join( | ||
__dirname, | ||
"fixtures/mapBasicReportFalse", | ||
), | ||
}, | ||
}, | ||
|
||
async testBody(t, driver, node, mockController, mockNode) { | ||
// Despite the compat flag, Basic CC should not be considered supported | ||
t.false(node.supportsCC(CommandClasses.Basic)); | ||
|
||
// But currentValue should be exposed - otherwise it makes no sense to not map it | ||
const valueIDs = node.getDefinedValueIDs(); | ||
t.true( | ||
valueIDs.some((v) => BasicCCValues.currentValue.is(v)), | ||
"Did not find Basic CC currentValue although it should be exposed", | ||
); | ||
t.false( | ||
valueIDs.some((v) => BasicCCValues.targetValue.is(v)), | ||
"Found Basic CC targetValue although it shouldn't be exposed", | ||
); | ||
}, | ||
}, | ||
); |
19 changes: 19 additions & 0 deletions
19
packages/zwave-js/src/lib/test/compat/fixtures/mapBasicReportFalse/deviceConfig.json
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,19 @@ | ||
{ | ||
"manufacturer": "Test Manufacturer", | ||
"manufacturerId": "0xdead", | ||
"label": "Test Device", | ||
"description": "With Basic Event", | ||
"devices": [ | ||
{ | ||
"productType": "0xbeef", | ||
"productId": "0xcafe" | ||
} | ||
], | ||
"firmwareVersion": { | ||
"min": "0.0", | ||
"max": "255.255" | ||
}, | ||
"compat": { | ||
"mapBasicReport": false | ||
} | ||
} |
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