Skip to content

Commit

Permalink
Fix #1065 - light level stuck at max (#1066)
Browse files Browse the repository at this point in the history
fix light level report, which was stuck at max due to the inappropriate
assignment operator.

## ♻️ 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.

## 💡 Proposed solution

This PR contains a one-line patch to fix the above.

## ⚙️ 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.
  • Loading branch information
4gra authored Oct 7, 2024
1 parent d84f57c commit e82b4e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/device/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand Down

0 comments on commit e82b4e1

Please sign in to comment.