UNPKG

homebridge-loxone-proxy

Version:

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

49 lines 2.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Fanv2 = void 0; const BaseService_1 = require("./BaseService"); class Fanv2 extends BaseService_1.BaseService { constructor() { super(...arguments); this.State = { Active: true, RotationSpeed: 0, }; } setupService() { this.service = this.accessory.getService(this.platform.Service.Fanv2) || this.accessory.addService(this.platform.Service.Fanv2); this.service.getCharacteristic(this.platform.Characteristic.Active) .onGet(() => this.handleActiveGet()) .onSet((value) => this.handleActiveSet(value)); this.service.getCharacteristic(this.platform.Characteristic.RotationSpeed) .onGet(() => this.handleRotationSpeedGet()); } updateService(message) { var _a, _b, _c, _d; this.platform.log.debug(`[${this.device.name}] Callback ${message.state} update for Fan: ${message.value}`); switch (message.state) { case 'mode': break; case 'speed': this.State.RotationSpeed = message.value; break; } (_b = (_a = this.service) === null || _a === void 0 ? void 0 : _a.getCharacteristic(this.platform.Characteristic.Active)) === null || _b === void 0 ? void 0 : _b.updateValue(this.State.Active); (_d = (_c = this.service) === null || _c === void 0 ? void 0 : _c.getCharacteristic(this.platform.Characteristic.RotationSpeed)) === null || _d === void 0 ? void 0 : _d.updateValue(this.State.RotationSpeed); } handleActiveGet() { this.platform.log.debug('Triggered GET Active'); return this.State.Active; } handleActiveSet(value) { this.platform.log.debug('Triggered SET Active: ' + value); } handleRotationSpeedGet() { this.platform.log.debug('Triggered GET RotationSpeed'); return this.State.RotationSpeed; } } exports.Fanv2 = Fanv2; //# sourceMappingURL=Fanv2.js.map