homebridge-loxone-proxy
Version:
Homebridge Dynamic Platform Plugin which exposes a Loxone System to Homekit.
34 lines • 1.31 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Window = void 0;
const BaseService_1 = require("./BaseService");
class Window extends BaseService_1.BaseService {
constructor() {
super(...arguments);
this.State = {
On: false,
};
}
setupService() {
this.service =
this.accessory.getService(this.platform.Service.Window) ||
this.accessory.addService(this.platform.Service.Window);
}
updateService(message) {
this.platform.log.debug(`[${this.device.name}] Callback state update for Switch: ${!!message.value}`);
this.State.On = !!message.value;
this.service.getCharacteristic(this.platform.Characteristic.On).updateValue(this.State.On);
}
async setOn(value) {
this.State.On = value;
this.platform.log.debug(`[${this.device.name}] Characteristic.On update from Homekit ->`, value);
const command = this.State.On ? 'On' : 'Off';
this.platform.log.debug(`[${this.device.name}] Send command to Loxone: ${command}`);
this.platform.LoxoneHandler.sendCommand(this.device.uuidAction, command);
}
async getOn() {
return this.State.On;
}
}
exports.Window = Window;
//# sourceMappingURL=Window.js.map