@@ -6,7 +6,7 @@ import * as legacy from '../lib/legacy';
6
6
import { battery , iasZoneAlarm } from '../lib/modernExtend' ;
7
7
import * as reporting from '../lib/reporting' ;
8
8
import * as tuya from '../lib/tuya' ;
9
- import { DefinitionWithExtend , Fz , KeyValue } from '../lib/types' ;
9
+ import { DefinitionWithExtend , Fz , KeyValue , Tz } from '../lib/types' ;
10
10
const e = exposes . presets ;
11
11
const ea = exposes . access ;
12
12
@@ -127,6 +127,15 @@ const fzLocal = {
127
127
} satisfies Fz . Converter ,
128
128
} ;
129
129
130
+ const tzLocal = {
131
+ PC321_clearMetering : {
132
+ key : [ 'clear_metering' ] ,
133
+ convertSet : async ( entity , key , value , meta ) => {
134
+ await entity . command ( 0xffe0 , 0x00 , { } , { disableDefaultResponse : true } ) ;
135
+ } ,
136
+ } satisfies Tz . Converter ,
137
+ } ;
138
+
130
139
const definitions : DefinitionWithExtend [ ] = [
131
140
{
132
141
zigbeeModel : [ 'WSP402' ] ,
@@ -302,7 +311,7 @@ const definitions: DefinitionWithExtend[] = [
302
311
vendor : 'OWON' ,
303
312
description : '3-Phase clamp power meter' ,
304
313
fromZigbee : [ fz . metering , fzLocal . PC321_metering ] ,
305
- toZigbee : [ ] ,
314
+ toZigbee : [ tzLocal . PC321_clearMetering ] ,
306
315
configure : async ( device , coordinatorEndpoint ) => {
307
316
const endpoint = device . getEndpoint ( 1 ) ;
308
317
await reporting . bind ( endpoint , coordinatorEndpoint , [ 'seMetering' ] ) ;
@@ -340,6 +349,7 @@ const definitions: DefinitionWithExtend[] = [
340
349
e . numeric ( 'power_factor_l1' , ea . STATE ) . withUnit ( '%' ) . withDescription ( 'Phase 1 power factor' ) ,
341
350
e . numeric ( 'power_factor_l2' , ea . STATE ) . withUnit ( '%' ) . withDescription ( 'Phase 2 power factor' ) ,
342
351
e . numeric ( 'power_factor_l3' , ea . STATE ) . withUnit ( '%' ) . withDescription ( 'Phase 3 power factor' ) ,
352
+ e . enum ( 'clear_metering' , ea . SET , [ 'clear' ] ) . withDescription ( 'Clear measurement data' ) ,
343
353
] ,
344
354
} ,
345
355
{
0 commit comments