@@ -203,9 +203,7 @@ const fzLocal = {
203
203
convert : ( model , msg , publish , options , meta ) => {
204
204
const bytes = [ ...msg . data ] ;
205
205
const messageType = bytes [ 3 ] ;
206
- const buttons : string [ ] = [ ] ;
207
206
let action = 'unknown' ;
208
- let speed = 0 ;
209
207
210
208
if ( messageType === 0x01 ) {
211
209
const pressTypeMask : number = bytes [ 6 ] ;
@@ -226,15 +224,17 @@ const fzLocal = {
226
224
16 : 'k12' ,
227
225
} ;
228
226
227
+ const actionButtons : string [ ] = [ ] ;
229
228
for ( let i = 0 ; i < 16 ; i ++ ) {
230
229
if ( ( buttonMask >> i ) & 1 ) {
231
230
const button = i + 1 ;
232
- buttons . push ( specialButtonMap [ button ] ?? `k${ button } ` ) ;
231
+ actionButtons . push ( specialButtonMap [ button ] ?? `k${ button } ` ) ;
233
232
}
234
233
}
234
+ return { action, action_buttons : actionButtons } ;
235
235
} else if ( messageType === 0x03 ) {
236
236
const directionMask = bytes [ 4 ] ;
237
- speed = bytes [ 6 ] ;
237
+ const actionSpeed = bytes [ 6 ] ;
238
238
239
239
const directionMap : { [ key : number ] : string } = {
240
240
0x01 : 'clockwise' ,
@@ -243,9 +243,10 @@ const fzLocal = {
243
243
const direction = directionMap [ directionMask ] || 'unknown' ;
244
244
245
245
action = `${ direction } _rotation` ;
246
+ return { action, action_speed : actionSpeed } ;
246
247
}
247
248
248
- return { action, buttons , speed } ;
249
+ return { action} ;
249
250
} ,
250
251
} satisfies Fz . Converter ,
251
252
} ;
@@ -268,9 +269,10 @@ const definitions: DefinitionWithExtend[] = [
268
269
description : 'Zigbee smart wall panel remote' ,
269
270
extend : [ battery ( ) ] ,
270
271
fromZigbee : [ fzLocal . sunricher_SRZG9002KR12Pro ] ,
272
+ exposes : [ e . action ( [ 'short_press' , 'double_press' , 'hold' , 'hold_released' , 'clockwise_rotation' , 'anti_clockwise_rotation' ] ) ] ,
271
273
} ,
272
274
{
273
- zigbeeModel : [ 'ZV9380A' ] ,
275
+ zigbeeModel : [ 'ZV9380A' , 'ZG9380A' ] ,
274
276
model : 'SR-ZG9042MP' ,
275
277
vendor : 'Sunricher' ,
276
278
description : 'Zigbee three phase power meter' ,
0 commit comments