Skip to content

Commit

Permalink
fix(discovery): use valueId endpoint device class for multilevel swit…
Browse files Browse the repository at this point in the history
…ch CC discovery

Fixes #3862
  • Loading branch information
robertsLando committed Sep 2, 2024
1 parent 5040e7e commit a41f560
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/lib/Gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,10 @@ export default class Gateway {

const cmdClass = valueId.commandClass

const deviceClass =
node.endpoints[valueId.endpoint]?.deviceClass ??
node.deviceClass

switch (cmdClass) {
case CommandClasses['Binary Switch']:
case CommandClasses['All Switch']:
Expand All @@ -1256,8 +1260,8 @@ export default class Gateway {
if (valueId.isCurrentValue) {
const specificDeviceClass =
Constants.specificDeviceClass(
node.deviceClass.generic,
node.deviceClass.specific,
deviceClass.generic,
deviceClass.specific,
)
// Use a cover_position configuration if ...
if (
Expand Down
3 changes: 3 additions & 0 deletions api/lib/ZwaveClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ import {
ProvisioningEntryStatus,
AssociationCheckResult,
LinkReliabilityCheckResult,
DeviceClass,
} from 'zwave-js'
import { getEnumMemberName, parseQRCodeString } from 'zwave-js/Utils'
import { logsDir, nvmBackupsDir, storeDir } from '../config/app'
Expand Down Expand Up @@ -467,6 +468,7 @@ export interface FwFile {
export interface ZUIEndpoint {
index: number
label?: string
deviceClass?: DeviceClass
}

export enum ZUIScheduleEntryLockMode {
Expand Down Expand Up @@ -6007,6 +6009,7 @@ class ZwaveClient extends TypedEventEmitter<ZwaveClientEventCallbacks> {
return {
index: e.index,
label: e.endpointLabel || defaultLabel,
deviceClass: e.deviceClass,
}
})
node.isSecure = zwaveNode.isSecure
Expand Down

0 comments on commit a41f560

Please sign in to comment.