Skip to content
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
38 changes: 38 additions & 0 deletions src/lib/generateDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ const INPUT_EXTENDERS: Extender[] = [
],
[["genBinaryInput"], extenderBinaryInput],
[["genBinaryOutput"], extenderBinaryOutput],
[["genAnalogInput"], extenderAnalogInput],
[["genAnalogOutput"], extenderAnalogOutput],
];

const OUTPUT_EXTENDERS: Extender[] = [
Expand Down Expand Up @@ -394,3 +396,39 @@ async function extenderBinaryOutput(device: Zh.Device, endpoints: Zh.Endpoint[])
}
return generated;
}

async function extenderAnalogInput(device: Zh.Device, endpoints: Zh.Endpoint[]): Promise<GeneratedExtend[]> {
const generated: GeneratedExtend[] = [];
for (const endpoint of endpoints) {
const description = `analog_input_${endpoint.ID}`;
const args: m.NumericArgs<"genAnalogInput"> = {
name: await getClusterAttributeValue(endpoint, "genAnalogInput", "description", description),
cluster: "genAnalogInput",
attribute: "presentValue",
reporting: {min: "MIN", max: "MAX", change: 1},
description: description,
access: "STATE_GET",
endpointNames: [`${endpoint.ID}`],
};
generated.push(new ExtendGenerator({extend: m.numeric, args, source: "analog"}));
}
return generated;
}

async function extenderAnalogOutput(device: Zh.Device, endpoints: Zh.Endpoint[]): Promise<GeneratedExtend[]> {
const generated: GeneratedExtend[] = [];
for (const endpoint of endpoints) {
const description = `analog_output_${endpoint.ID}`;
const args: m.NumericArgs<"genAnalogOutput"> = {
name: await getClusterAttributeValue(endpoint, "genAnalogOutput", "description", description),
cluster: "genAnalogOutput",
attribute: "presentValue",
reporting: {min: "MIN", max: "MAX", change: 1},
description: description,
access: "ALL",
endpointNames: [`${endpoint.ID}`],
};
generated.push(new ExtendGenerator({extend: m.numeric, args, source: "analog"}));
}
return generated;
}