@uboness/homebridge-unifi-access
Version:
Homebridge Unifi Access Plugin
39 lines • 1.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Device = void 0;
const common_1 = require("../common");
class Device {
constructor(platform, client, accessory, device, primaryService) {
var _a;
this.detachables = new common_1.Detachables();
this.platform = platform;
this.client = client;
this.accessory = accessory;
this.device = device;
this.logger = platform.logger.getLogger(this.type, this.name);
this.primaryService = primaryService;
this.primaryService.setPrimaryService(true);
this.primaryService.setCharacteristic(platform.Characteristic.Name, accessory.displayName);
this.primaryService.addOptionalCharacteristic(platform.Characteristic.StatusFault);
this.statusFault = (_a = this.primaryService.getCharacteristic(platform.Characteristic.StatusFault)) !== null && _a !== void 0 ? _a : this.primaryService.addCharacteristic(platform.Characteristic.StatusFault);
this.statusFault.setValue(true);
this.detachables.add(client.on('message', (message) => {
this.onMessage(message, platform);
}));
}
get id() {
return this.device.id;
}
get type() {
return this.device.type;
}
get name() {
return this.device.name;
}
async close() {
this.detachables.detach();
await this.doClose();
}
}
exports.Device = Device;
//# sourceMappingURL=Device.js.map