diff --git a/src/device/curtain.ts b/src/device/curtain.ts index 27700c7f..53f8be5a 100644 --- a/src/device/curtain.ts +++ b/src/device/curtain.ts @@ -392,13 +392,15 @@ export class Curtain extends deviceBase { this.debugLog(`LightLevel: ${this.serviceData.lightLevel}, CurrentAmbientLightLevel: ${this.LightSensor.CurrentAmbientLightLevel}`) } // BatteryLevel - this.Battery.BatteryLevel = this.serviceData.battery - this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`) - // StatusLowBattery - this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10 - ? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW - : this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL - this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`) + if (this.serviceData.battery) { + this.Battery.BatteryLevel = this.serviceData.battery + this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`) + // StatusLowBattery + this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10 + ? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW + : this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL + this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`) + } } async openAPIparseStatus(): Promise {