From f3d14690510239fee01dd0ecad8c0b4238bb0856 Mon Sep 17 00:00:00 2001 From: eyenseo Date: Sun, 19 Jan 2025 14:50:46 +0100 Subject: [PATCH] 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. --- src/lib/modernExtend.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/modernExtend.ts b/src/lib/modernExtend.ts index 17dc0dc5d6dcc8..e3ed23034b8293 100644 --- a/src/lib/modernExtend.ts +++ b/src/lib/modernExtend.ts @@ -941,15 +941,18 @@ export function occupancy(args?: OccupancyArgs): ModernExtend { } export function co2(args?: Partial) { + const fraction_of_1: ScaleFunction = (value: number, type: 'from' | 'to') => { + return 1 / number; + }; 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, });