From e82b4e10a8aa0f2e8e79ea75d242c14a175ac29f Mon Sep 17 00:00:00 2001 From: Graham <4gra@users.noreply.github.com> Date: Mon, 7 Oct 2024 04:45:36 +0100 Subject: [PATCH] Fix #1065 - light level stuck at max (#1066) fix light level report, which was stuck at max due to the inappropriate assignment operator. ## :recycle: Current situation See #1065 - ambient light level reported to HomeKit is stuck at 6000 lux despite light level report being accurate. Debugging revealed an accidental assignment operator ("=") where a comparison ("===") was required. ## :bulb: Proposed solution This PR contains a one-line patch to fix the above. ## :gear: Release Notes No change required. ### Testing Not aware of any relevant tests ### Reviewer Nudging Observe the ambient light level of a connected hub 2 in home bridge UI before and after the patch. --- src/device/device.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device/device.ts b/src/device/device.ts index 57afada3..62a9e4d8 100644 --- a/src/device/device.ts +++ b/src/device/device.ts @@ -218,7 +218,7 @@ export abstract class deviceBase { this.debugLog(`LightLevel: ${lightLevel}, set_minLux: ${set_minLux}, set_maxLux: ${set_maxLux}, spaceBetweenLevels: ${spaceBetweenLevels}, numberOfLevels: ${numberOfLevels}`) const CurrentAmbientLightLevel = lightLevel === 1 ? set_minLux - : lightLevel = numberOfLevels + : lightLevel === numberOfLevels ? set_maxLux : ((set_maxLux - set_minLux) / spaceBetweenLevels) * (Number(lightLevel) - 1) await this.debugLog(`CurrentAmbientLightLevel: ${CurrentAmbientLightLevel}, LightLevel: ${lightLevel}, set_minLux: ${set_minLux}, set_maxLux: ${set_maxLux}`)