UNPKG

homebridge-loxone-proxy

Version:

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

41 lines 1.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InfoOnlyDigital = void 0; const LoxoneAccessory_1 = require("../../LoxoneAccessory"); const LeakSensor_1 = require("../../homekit/services/LeakSensor"); const MotionSensor_1 = require("../../homekit/services/MotionSensor"); const SmokeSensor_1 = require("../../homekit/services/SmokeSensor"); class InfoOnlyDigital extends LoxoneAccessory_1.LoxoneAccessory { constructor(platform, device) { super(platform, device); } isSupported() { const { config } = this.platform; const aliases = config.InfoOnlyDigitalAlias; const serviceTypeMap = new Map([ ['Motion', MotionSensor_1.MotionSensor], ['Smoke', SmokeSensor_1.SmokeSensor], ['Leak', LeakSensor_1.LeakSensor], ]); for (const [key, alias] of Object.entries(aliases)) { if (this.matchAlias(this.device.name, alias)) { this.ServiceType = serviceTypeMap.get(key) || this.ServiceType; if (this.ServiceType) { this.device.name = `${this.device.room} (${this.device.name})`; return true; } } } return false; } configureServices() { this.ItemStates = { [this.device.states.active]: { service: 'PrimaryService', state: 'active' }, }; if (this.ServiceType) { this.Service.PrimaryService = new this.ServiceType(this.platform, this.Accessory, this.device); } } } exports.InfoOnlyDigital = InfoOnlyDigital; //# sourceMappingURL=InfoOnlyDigital.js.map