diff --git a/src/devices/owon.ts b/src/devices/owon.ts index 6544588d0d1b4..3d6b8e6728549 100644 --- a/src/devices/owon.ts +++ b/src/devices/owon.ts @@ -6,7 +6,7 @@ import * as legacy from '../lib/legacy'; import {battery, iasZoneAlarm} from '../lib/modernExtend'; import * as reporting from '../lib/reporting'; import * as tuya from '../lib/tuya'; -import {DefinitionWithExtend, Fz, KeyValue} from '../lib/types'; +import {DefinitionWithExtend, Fz, KeyValue, Tz} from '../lib/types'; const e = exposes.presets; const ea = exposes.access; @@ -127,6 +127,15 @@ const fzLocal = { } satisfies Fz.Converter, }; +const tzLocal = { + PC321_clearMetering: { + key: ['clear_metering'], + convertSet: async (entity, key, value, meta) => { + await entity.command(0xffe0, 0x00, {}, {disableDefaultResponse: true}); + }, + } satisfies Tz.Converter, +}; + const definitions: DefinitionWithExtend[] = [ { zigbeeModel: ['WSP402'], @@ -302,7 +311,7 @@ const definitions: DefinitionWithExtend[] = [ vendor: 'OWON', description: '3-Phase clamp power meter', fromZigbee: [fz.metering, fzLocal.PC321_metering], - toZigbee: [], + toZigbee: [tzLocal.PC321_clearMetering], configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['seMetering']); @@ -340,6 +349,7 @@ const definitions: DefinitionWithExtend[] = [ e.numeric('power_factor_l1', ea.STATE).withUnit('%').withDescription('Phase 1 power factor'), e.numeric('power_factor_l2', ea.STATE).withUnit('%').withDescription('Phase 2 power factor'), e.numeric('power_factor_l3', ea.STATE).withUnit('%').withDescription('Phase 3 power factor'), + e.enum('clear_metering', ea.SET, ['clear']).withDescription('Clear measurement data'), ], }, {