Skip to content

Commit f508a93

Browse files
committed
Parameterize internalTemperature reporting via temperatureReporting option
1 parent 1ea0d08 commit f508a93

3 files changed

Lines changed: 18 additions & 14 deletions

File tree

src/devices/inovelli.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const definitions: DefinitionWithExtend[] = [
1919
inovelli.m.parameters({
2020
attrs: [{attributes: inovelli.VZM30_ATTRIBUTES, clusterName: inovelli.CLUSTER_NAME}],
2121
model: inovelli.Model.VZM30,
22+
temperatureReporting: {min: 1800, max: 3600, change: 5},
2223
}),
2324
inovelli.m.addCustomCluster(),
2425
m.identify(),
@@ -45,6 +46,7 @@ export const definitions: DefinitionWithExtend[] = [
4546
inovelli.m.parameters({
4647
attrs: [{attributes: inovelli.VZM31_ATTRIBUTES, clusterName: inovelli.CLUSTER_NAME}],
4748
model: inovelli.Model.VZM31,
49+
temperatureReporting: {min: 1800, max: 3600, change: 5},
4850
}),
4951
inovelli.m.addCustomCluster(),
5052
m.identify(),

src/lib/inovelli.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,12 @@ const inovelliExtend = {
618618
attrs,
619619
model,
620620
splitValuesByEndpoint = false,
621+
temperatureReporting,
621622
}: {
622623
attrs: Array<{attributes: {[s: string]: Attribute}; clusterName: typeof INOVELLI_CLUSTER_NAME | typeof INOVELLI_MMWAVE_CLUSTER_NAME}>;
623624
model: Model;
624625
splitValuesByEndpoint?: boolean;
626+
temperatureReporting?: {min: number; max: number; change: number};
625627
}): ModernExtend => {
626628
const fromZigbee: NonNullable<ModernExtend["fromZigbee"]> = [];
627629
const toZigbee: Tz.Converter[] = [];
@@ -654,11 +656,18 @@ const inovelliExtend = {
654656
const endpoint = device.getEndpoint(1);
655657
await reporting.bind(endpoint, coordinatorEndpoint, [INOVELLI_CLUSTER_NAME]);
656658

657-
await endpoint
658-
.configureReporting(INOVELLI_CLUSTER_NAME, [
659-
{attribute: 32, minimumReportInterval: 1800, maximumReportInterval: 3600, reportableChange: 5},
660-
])
661-
.catch((e) => logger.warning(`Failed to configure internalTemperature reporting: ${e.message}`, "zhc:inovelli"));
659+
if (temperatureReporting) {
660+
await endpoint
661+
.configureReporting(INOVELLI_CLUSTER_NAME, [
662+
{
663+
attribute: 32,
664+
minimumReportInterval: temperatureReporting.min,
665+
maximumReportInterval: temperatureReporting.max,
666+
reportableChange: temperatureReporting.change,
667+
},
668+
])
669+
.catch((e) => logger.warning(`Failed to configure internalTemperature reporting: ${e.message}`, "zhc:inovelli"));
670+
}
662671

663672
let endpoint2: Zh.Endpoint | undefined;
664673
if (splitValuesByEndpoint) {

test/inovelli.test.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,7 +2693,6 @@ describe("Inovelli VZM32-SN definition integration", () => {
26932693
configureReporting: {
26942694
1: [
26952695
{cluster: "genOnOff", items: [{attribute: "onOff", min: 0, max: 3600, change: 0}]},
2696-
{cluster: "manuSpecificInovelli", items: [{attribute: 32, min: 1800, max: 3600, change: 5}]},
26972696
{
26982697
cluster: "haElectricalMeasurement",
26992698
items: [
@@ -2919,10 +2918,7 @@ describe("Inovelli VZM35-SN definition integration", () => {
29192918
writeCount: {1: 0, 2: 0},
29202919
// fan() extend also configures onOff reporting on EP1; no other reporting clusters for VZM35-SN.
29212920
configureReporting: {
2922-
1: [
2923-
{cluster: "genOnOff", items: [{attribute: "onOff", min: 0, max: 3600, change: 0}]},
2924-
{cluster: "manuSpecificInovelli", items: [{attribute: 32, min: 1800, max: 3600, change: 5}]},
2925-
],
2921+
1: [{cluster: "genOnOff", items: [{attribute: "onOff", min: 0, max: 3600, change: 0}]}],
29262922
2: [],
29272923
},
29282924
});
@@ -3042,10 +3038,7 @@ describe("Inovelli VZM36 definition integration", () => {
30423038
writeCount: {1: 0, 2: 0},
30433039
// light() configures onOff reporting on EP1; fan() configures onOff reporting on EP2.
30443040
configureReporting: {
3045-
1: [
3046-
{cluster: "genOnOff", items: [{attribute: "onOff", min: 0, max: 3600, change: 0}]},
3047-
{cluster: "manuSpecificInovelli", items: [{attribute: 32, min: 1800, max: 3600, change: 5}]},
3048-
],
3041+
1: [{cluster: "genOnOff", items: [{attribute: "onOff", min: 0, max: 3600, change: 0}]}],
30493042
2: [{cluster: "genOnOff", items: [{attribute: "onOff", min: 0, max: 3600, change: 0}]}],
30503043
},
30513044
});

0 commit comments

Comments
 (0)