UNPKG

@petro-kushchak/homebridge-ch-gree-ac-eve-platform

Version:

Cooper&Hunter (based on Gree AC API) AC plugin for Homebridge (Homekit) with Web Hook/MQTT Data Sharing

33 lines 1.28 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const acStatus_1 = __importDefault(require("../utils/acStatus")); const acSender_1 = __importDefault(require("../utils/acSender")); class ACLight { constructor(platform, accessory) { this.platform = platform; this.accessory = accessory; this.service = this.accessory.getService(this.platform.Service.Lightbulb) || this.accessory.addService(this.platform.Service.Lightbulb); this.getStatus = (0, acStatus_1.default)(this.accessory.context.device); this.sendData = (0, acSender_1.default)(this.accessory.context.device); this.service .getCharacteristic(this.platform.Characteristic.On) .onGet(this.handleOnGet.bind(this)) .onSet(this.handleOnSet.bind(this)); } async handleOnGet() { const status = await this.getStatus(); return status.Lig === 1; } async handleOnSet(value) { await this.sendData({ Lig: value ? 1 : 0 }); } } exports.default = ACLight; //# sourceMappingURL=ACLight.js.map