Skip to content

Commit

Permalink
fix(homebridge): prevent undefined brightness for alarms
Browse files Browse the repository at this point in the history
Closes #1057
  • Loading branch information
dgreif committed Oct 2, 2022
1 parent 35f1932 commit 08aa0ea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions homebridge/brightness-only.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ export class BrightnessOnly extends BaseDeviceAccessory {
const { Characteristic, Service } = hap,
{ context } = accessory

if ('brightness' in device.data && !isNaN(device.data.brightness!)) {
if (
device.data.brightness !== undefined &&
!isNaN(device.data.brightness)
) {
this.registerLevelCharacteristic({
characteristicType: Characteristic.Brightness,
serviceType: Service.Lightbulb,
getValue: (data) => {
if (!data.brightness || isNaN(data.brightness)) {
return undefined
return 0
}

// store the brightness so that we can set it again if light is turned off then back on
Expand Down

0 comments on commit 08aa0ea

Please sign in to comment.