From bd2c931eaa2f512f262e4ff61e32ade442efa68a Mon Sep 17 00:00:00 2001 From: Serge Wagener Date: Thu, 10 Feb 2022 18:44:40 +0100 Subject: [PATCH] Added transposing debug message on lightbulb --- src/Accessories/Lightbulb.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Accessories/Lightbulb.ts b/src/Accessories/Lightbulb.ts index b5ddc2d..f251c06 100644 --- a/src/Accessories/Lightbulb.ts +++ b/src/Accessories/Lightbulb.ts @@ -288,6 +288,13 @@ export class Lightbulb implements AccessoryPlugin { } convertRange(value: number, oldmin: number, oldmax: number, newmin: number, newmax: number): number { - return (((value - oldmin) * (newmax - newmin)) / (oldmax - oldmin)) + newmin; + const result = (((value - oldmin) * (newmax - newmin)) / (oldmax - oldmin)) + newmin; + this.platform.log.debug( + 'Transposing', value, + 'from range', oldmin, '-', oldmax, + 'to', newmin, '-', newmax, + '=', result, + ); + return result; } }