File tree 9 files changed +323
-203
lines changed
9 files changed +323
-203
lines changed Original file line number Diff line number Diff line change 34
34
"ws" : " ^8.13.0"
35
35
},
36
36
"peerDependencies" : {
37
- "zwave-js" : " ^12.11 .0"
37
+ "zwave-js" : " ^13.0 .0"
38
38
},
39
39
"devDependencies" : {
40
40
"@tsconfig/node18" : " ^18.2.1" ,
54
54
"semver" : " ^7.5.4" ,
55
55
"ts-node" : " ^10.9.2" ,
56
56
"typescript" : " ^5.3.3" ,
57
- "zwave-js" : " ^12.11 .0"
57
+ "zwave-js" : " ^13.0 .0"
58
58
},
59
59
"husky" : {
60
60
"hooks" : {
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export const version = require("../../package.json").version;
4
4
export const minSchemaVersion = 0 ;
5
5
6
6
// maximal/current schema version the server supports
7
- export const maxSchemaVersion = 36 ;
7
+ export const maxSchemaVersion = 37 ;
8
8
9
9
export const applicationName = "zwave-js-server" ;
10
10
export const dnssdServiceType = applicationName ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export enum ControllerCommand {
20
20
isFailedNode = "controller.is_failed_node" ,
21
21
getAssociationGroups = "controller.get_association_groups" ,
22
22
getAssociations = "controller.get_associations" ,
23
+ checkAssociation = "controller.check_association" ,
23
24
isAssociationAllowed = "controller.is_association_allowed" ,
24
25
addAssociations = "controller.add_associations" ,
25
26
removeAssociations = "controller.remove_associations" ,
Original file line number Diff line number Diff line change @@ -137,6 +137,15 @@ export interface IncomingCommandControllerGetAssociations
137
137
endpoint ?: number ;
138
138
}
139
139
140
+ export interface IncomingCommandControllerCheckAssociation
141
+ extends IncomingCommandControllerBase {
142
+ command : ControllerCommand . checkAssociation ;
143
+ nodeId : number ;
144
+ group : number ;
145
+ association : AssociationAddress ;
146
+ endpoint ?: number ;
147
+ }
148
+
140
149
export interface IncomingCommandControllerIsAssociationAllowed
141
150
extends IncomingCommandControllerBase {
142
151
command : ControllerCommand . isAssociationAllowed ;
@@ -350,6 +359,7 @@ export type IncomingMessageController =
350
359
| IncomingCommandControllerIsFailedNode
351
360
| IncomingCommandControllerGetAssociationGroups
352
361
| IncomingCommandControllerGetAssociations
362
+ | IncomingCommandControllerCheckAssociation
353
363
| IncomingCommandControllerIsAssociationAllowed
354
364
| IncomingCommandControllerAddAssociations
355
365
| IncomingCommandControllerRemoveAssociations
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
13
13
guessFirmwareFileFormat ,
14
14
ExclusionStrategy ,
15
15
ExclusionOptions ,
16
+ AssociationCheckResult ,
16
17
} from "zwave-js" ;
17
18
import { dumpController } from ".." ;
18
19
import {
@@ -186,13 +187,21 @@ export class ControllerMessageHandler {
186
187
. forEach ( ( value , key ) => ( associations [ key ] = value ) ) ;
187
188
return { associations } ;
188
189
}
190
+ case ControllerCommand . checkAssociation : {
191
+ const result = driver . controller . checkAssociation (
192
+ { nodeId : message . nodeId , endpoint : message . endpoint } ,
193
+ message . group ,
194
+ message . association ,
195
+ ) ;
196
+ return { result } ;
197
+ }
189
198
case ControllerCommand . isAssociationAllowed : {
190
- const allowed = driver . controller . isAssociationAllowed (
199
+ const result = driver . controller . checkAssociation (
191
200
{ nodeId : message . nodeId , endpoint : message . endpoint } ,
192
201
message . group ,
193
202
message . association ,
194
203
) ;
195
- return { allowed } ;
204
+ return { allowed : result === AssociationCheckResult . OK } ;
196
205
}
197
206
case ControllerCommand . addAssociations : {
198
207
await driver . controller . addAssociations (
Original file line number Diff line number Diff line change 1
1
import {
2
2
AssociationAddress ,
3
+ AssociationCheckResult ,
3
4
AssociationGroup ,
4
5
FirmwareUpdateInfo ,
5
6
LifelineRoutes ,
@@ -31,6 +32,7 @@ export interface ControllerResultTypes {
31
32
[ ControllerCommand . getAssociations ] : {
32
33
associations : Record < number , readonly AssociationAddress [ ] > ;
33
34
} ;
35
+ [ ControllerCommand . checkAssociation ] : { result : AssociationCheckResult } ;
34
36
[ ControllerCommand . isAssociationAllowed ] : { allowed : boolean } ;
35
37
[ ControllerCommand . addAssociations ] : Record < string , never > ;
36
38
[ ControllerCommand . removeAssociations ] : Record < string , never > ;
Original file line number Diff line number Diff line change 3
3
Endpoint ,
4
4
FirmwareUpdateProgress ,
5
5
FirmwareUpdateResult ,
6
+ InclusionStrategy ,
6
7
NodeStatistics ,
7
8
NodeStatus ,
8
9
RemoveNodeReason ,
@@ -84,12 +85,26 @@ export class EventForwarder {
84
85
}
85
86
}
86
87
87
- this . clientsController . driver . controller . on ( "inclusion started" , ( secure ) =>
88
- this . forwardEvent ( {
89
- source : "controller" ,
90
- event : "inclusion started" ,
91
- secure,
92
- } ) ,
88
+ this . clientsController . driver . controller . on (
89
+ "inclusion started" ,
90
+ ( strategy ) => {
91
+ // forward event to all connected clients, respecting schemaVersion it supports
92
+ this . clientsController . clients . forEach ( ( client ) => {
93
+ if ( client . schemaVersion >= 37 ) {
94
+ this . sendEvent ( client , {
95
+ source : "controller" ,
96
+ event : "inclusion started" ,
97
+ strategy,
98
+ } ) ;
99
+ } else {
100
+ this . sendEvent ( client , {
101
+ source : "controller" ,
102
+ event : "inclusion started" ,
103
+ secure : strategy !== InclusionStrategy . Insecure ,
104
+ } ) ;
105
+ }
106
+ } ) ;
107
+ } ,
93
108
) ;
94
109
95
110
this . clientsController . driver . controller . on (
Original file line number Diff line number Diff line change @@ -24,9 +24,11 @@ import {
24
24
InclusionState ,
25
25
FoundNode ,
26
26
RebuildRoutesStatus ,
27
+ getEnumMemberName ,
27
28
} from "zwave-js" ;
28
29
import { DeviceConfig } from "@zwave-js/config" ;
29
30
import {
31
+ BasicDeviceClass ,
30
32
CommandClasses ,
31
33
ConfigurationMetadata ,
32
34
ConfigValue ,
@@ -467,7 +469,6 @@ export const dumpConfigurationMetadata = (
467
469
unit : metadata . unit ,
468
470
valueSize : metadata . valueSize ,
469
471
format : metadata . format ,
470
- noBulkSupport : metadata . noBulkSupport ,
471
472
isAdvanced : metadata . isAdvanced ,
472
473
requiresReInclusion : metadata . requiresReInclusion ,
473
474
allowManualEntry : metadata . allowManualEntry ,
@@ -775,8 +776,8 @@ export const dumpDeviceClass = (
775
776
) : DeviceClassState => {
776
777
const base : Partial < DeviceClassState0 > = {
777
778
basic : {
778
- key : deviceClass . basic . key ,
779
- label : deviceClass . basic . label ,
779
+ key : deviceClass . basic ,
780
+ label : getEnumMemberName ( BasicDeviceClass , deviceClass . basic ) ,
780
781
} ,
781
782
generic : {
782
783
key : deviceClass . generic . key ,
You can’t perform that action at this time.
0 commit comments