homebridge-lg-ac
Version:
A Homebridge plugin for controlling/monitoring LG AirConditioning device via LG ThinQ platform.
35 lines • 1.36 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LightUnit = void 0;
const events_1 = __importDefault(require("events"));
class LightUnit extends events_1.default {
constructor(controller, platform, accessory) {
super();
this.controller = controller;
this.platform = platform;
this.accessory = accessory;
const { Service: { Switch }, Characteristic, } = this.platform;
this.ThinQ = this.platform.ThinQ;
this.device = this.accessory.context.device;
this.service = this.accessory.getService(Switch) ||
this.accessory.addService(Switch, 'LED', 'LED');
this.service.updateCharacteristic(Characteristic.ConfiguredName, 'LED');
this.service
.getCharacteristic(Characteristic.On)
.onSet((value) => {
this.controller.setLight(value);
});
}
update(device) {
const { Characteristic } = this.platform;
this.service.updateCharacteristic(Characteristic.On, this.controller.isLightOn);
}
remove() {
this.accessory.removeService(this.service);
}
}
exports.LightUnit = LightUnit;
//# sourceMappingURL=LightUnit.js.map