UNPKG

homebridge-loxone-proxy

Version:

Homebridge Dynamic Platform Plugin which exposes a Loxone System to Homekit.

32 lines 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LightSensor = void 0; const BaseService_1 = require("./BaseService"); class LightSensor extends BaseService_1.BaseService { constructor() { super(...arguments); this.State = { CurrentAmbientLightLevel: 0.0001, }; } setupService() { this.service = this.accessory.getService(this.platform.Service.LightSensor) || this.accessory.addService(this.platform.Service.LightSensor); this.service.getCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel) .onGet(this.handleCurrentAmbientLightLevelGet.bind(this)); } updateService(message) { this.platform.log.debug(`[${this.device.name}] Callback state update for Light Sensor: ${message.value}`); this.State.CurrentAmbientLightLevel = message.value > 0.0001 ? message.value : 0.0001; this.service .getCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel) .updateValue(this.State.CurrentAmbientLightLevel); } handleCurrentAmbientLightLevelGet() { this.platform.log.debug('Triggered GET CurrentAmbientLightLevel'); return this.State.CurrentAmbientLightLevel; } } exports.LightSensor = LightSensor; //# sourceMappingURL=LightSensor.js.map