Skip to content

Commit

Permalink
Change modernExtends too
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Eyenseo committed Jan 19, 2025
1 parent ba3f0e6 commit f3d1469
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/modernExtend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -941,15 +941,18 @@ export function occupancy(args?: OccupancyArgs): ModernExtend {
}

export function co2(args?: Partial<NumericArgs>) {
const fraction_of_1: ScaleFunction = (value: number, type: 'from' | 'to') => {
return 1 / number;

Check failure on line 945 in src/lib/modernExtend.ts

View workflow job for this annotation

GitHub Actions / ci

'number' only refers to a type, but is being used as a value here.
};
return numeric({
name: 'co2',
cluster: 'msCO2',
label: 'CO2',
attribute: 'measuredValue',
reporting: {min: '10_SECONDS', max: '1_HOUR', change: 0.00005}, // 50 ppm change
reporting: {min: '10_SECONDS', max: '1_HOUR', change: fraction_of_1(50 /*ppm*/, 'to')},
description: 'Measured value',
unit: 'ppm',
scale: 0.000001,
scale: fraction_of_1,
access: 'STATE_GET',
...args,
});
Expand Down

0 comments on commit f3d1469

Please sign in to comment.