Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OWON PC 321 - Add clear measurement data #7895

Merged
merged 4 commits into from
Sep 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/devices/owon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,20 @@ const fzLocal = {
},
} satisfies Fz.Converter,
};
const tzLocal = {
PC321_clearMetering: {
key: ['clear_metering'],
convertSet: async (entity, key, value, meta) => {
const endpoint = meta.device.getEndpoint(1);
const group = 0xFFE0;
const command = 0x00;
const payload = {};

await endpoint.command(group, command, payload, {disableDefaultResponse: true});
Koenkk marked this conversation as resolved.
Show resolved Hide resolved
meta.logger.info(`Sent clear command to ${entity.ieeeAddr}`);
},
},
};
const definitions: Definition[] = [
{
zigbeeModel: ['WSP402'],
Expand Down Expand Up @@ -302,7 +315,7 @@ const definitions: Definition[] = [
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']);
Expand Down Expand Up @@ -340,6 +353,7 @@ const definitions: Definition[] = [
e.numeric('power_factor_l1', ea.STATE).withDescription('Phase 1 power factor'),
e.numeric('power_factor_l2', ea.STATE).withDescription('Phase 2 power factor'),
e.numeric('power_factor_l3', ea.STATE).withDescription('Phase 3 power factor'),
e.enum('clear_metering', ea.SET, ['Clear']).withDescription('Clear measurement data'),
],
},
{
Expand Down