Skip to content

Commit

Permalink
Fix for "Lightbulb must have the ColorTemperature characteristic adde…
Browse files Browse the repository at this point in the history
…d" (#1136)
  • Loading branch information
semih-akbas authored Dec 13, 2024
1 parent 9869884 commit bf3b145
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/device/colorbulb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,6 @@ export class ColorBulb extends deviceBase {
}
accessory.context.LightBulb = this.LightBulb as object

if (this.adaptiveLighting && this.adaptiveLightingShift === -1 && this.LightBulb) {
accessory.removeService(this.LightBulb.Service)
this.LightBulb.Service = accessory.addService(this.hap.Service.Lightbulb)
accessory.context.adaptiveLighting = false
this.debugLog(`adaptiveLighting: ${this.adaptiveLighting}`)
} else if (this.adaptiveLighting && this.adaptiveLightingShift >= 0 && this.LightBulb) {
this.AdaptiveLightingController = new platform.api.hap.AdaptiveLightingController(this.LightBulb.Service, {
controllerMode: this.hap.AdaptiveLightingControllerMode.AUTOMATIC,
customTemperatureAdjustment: this.adaptiveLightingShift,
})
accessory.configureController(this.AdaptiveLightingController)
accessory.context.adaptiveLighting = true
this.debugLog(`adaptiveLighting: ${this.adaptiveLighting}, adaptiveLightingShift: ${this.adaptiveLightingShift}`,
)
} else {
accessory.context.adaptiveLighting = false
this.debugLog(`adaptiveLighting: ${accessory.context.adaptiveLighting}`)
}

// Initialize LightBulb Characteristics
this.LightBulb.Service.setCharacteristic(this.hap.Characteristic.Name, this.LightBulb.Name).getCharacteristic(this.hap.Characteristic.On).onGet(() => {
return this.LightBulb.On
Expand Down Expand Up @@ -138,6 +119,27 @@ export class ColorBulb extends deviceBase {
}).onGet(() => {
return this.LightBulb.Saturation
}).onSet(this.SaturationSet.bind(this))

Check failure on line 122 in src/device/colorbulb.ts

View workflow job for this annotation

GitHub Actions / lint / ESLint

Trailing spaces not allowed

Check failure on line 123 in src/device/colorbulb.ts

View workflow job for this annotation

GitHub Actions / lint / ESLint

More than 1 blank line not allowed
if (this.adaptiveLighting && this.adaptiveLightingShift === -1 && this.LightBulb) {
accessory.removeService(this.LightBulb.Service)
this.LightBulb.Service = accessory.addService(this.hap.Service.Lightbulb)
accessory.context.adaptiveLighting = false
this.debugLog(`adaptiveLighting: ${this.adaptiveLighting}`)
} else if (this.adaptiveLighting && this.adaptiveLightingShift >= 0 && this.LightBulb) {
this.AdaptiveLightingController = new platform.api.hap.AdaptiveLightingController(this.LightBulb.Service, {
controllerMode: this.hap.AdaptiveLightingControllerMode.AUTOMATIC,
customTemperatureAdjustment: this.adaptiveLightingShift,
})
accessory.configureController(this.AdaptiveLightingController)
accessory.context.adaptiveLighting = true
this.debugLog(`adaptiveLighting: ${this.adaptiveLighting}, adaptiveLightingShift: ${this.adaptiveLightingShift}`,
)
} else {
accessory.context.adaptiveLighting = false
this.debugLog(`adaptiveLighting: ${accessory.context.adaptiveLighting}`)
}


Check failure on line 143 in src/device/colorbulb.ts

View workflow job for this annotation

GitHub Actions / lint / ESLint

More than 1 blank line not allowed
// Retrieve initial values and updateHomekit
try {
Expand Down

0 comments on commit bf3b145

Please sign in to comment.