UNPKG

homebridge-loxone-proxy

Version:

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

38 lines 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ContactSensor = void 0; const BaseService_1 = require("./BaseService"); class ContactSensor extends BaseService_1.BaseService { constructor() { super(...arguments); this.State = { ContactSensorState: 0, }; } setupService() { this.service = this.accessory.getService(this.platform.Service.ContactSensor) || this.accessory.addService(this.platform.Service.ContactSensor); this.service.getCharacteristic(this.platform.Characteristic.ContactSensorState) .onGet(this.getOn.bind(this)); } updateService(message) { const valuesArray = message.value.split(','); const itemEntry = valuesArray[this.device.cat]; this.platform.log.debug(`[${this.device.name}] Callback state update for ContactSensor: ${itemEntry}`); switch (itemEntry) { case '1': case '8': this.State.ContactSensorState = 0; break; default: this.State.ContactSensorState = 1; } this.service.getCharacteristic(this.platform.Characteristic.ContactSensorState).updateValue(this.State.ContactSensorState); } async getOn() { return this.State.ContactSensorState; } } exports.ContactSensor = ContactSensor; //# sourceMappingURL=ContactSensor.js.map