Skip to content

Commit f3d1469

Browse files
committed
Change modernExtends too
This field is interpreted by the device and the device will have to undo the fraction to figure out if there's something to report.
1 parent ba3f0e6 commit f3d1469

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/lib/modernExtend.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -941,15 +941,18 @@ export function occupancy(args?: OccupancyArgs): ModernExtend {
941941
}
942942

943943
export function co2(args?: Partial<NumericArgs>) {
944+
const fraction_of_1: ScaleFunction = (value: number, type: 'from' | 'to') => {
945+
return 1 / number;
946+
};
944947
return numeric({
945948
name: 'co2',
946949
cluster: 'msCO2',
947950
label: 'CO2',
948951
attribute: 'measuredValue',
949-
reporting: {min: '10_SECONDS', max: '1_HOUR', change: 0.00005}, // 50 ppm change
952+
reporting: {min: '10_SECONDS', max: '1_HOUR', change: fraction_of_1(50 /*ppm*/, 'to')},
950953
description: 'Measured value',
951954
unit: 'ppm',
952-
scale: 0.000001,
955+
scale: fraction_of_1,
953956
access: 'STATE_GET',
954957
...args,
955958
});

0 commit comments

Comments
 (0)