UNPKG

@elshaer/homebridge-lg-thinq

Version:

A Homebridge plugin for controlling/monitoring LG ThinQ device via LG ThinQ platform.

59 lines 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Device = void 0; const constants_1 = require("./constants"); class Device { constructor(data) { this.data = data; } get id() { return this.data.deviceId; } get name() { return this.data.alias; } get type() { return constants_1.DeviceType[this.data.deviceType]; } get model() { var _a, _b; const modelName = this.data.modelName || ((_a = this.data.modemInfo) === null || _a === void 0 ? void 0 : _a.modelName) || ((_b = this.data.manufacture) === null || _b === void 0 ? void 0 : _b.manufactureModel); if (/^([A-Z]+)_(\d+)_([A-Z]{2})$/.test(modelName)) { return modelName.slice(0, -3); } return modelName; } get macAddress() { var _a; return (_a = this.data.manufacture) === null || _a === void 0 ? void 0 : _a.macAddress; } get salesModel() { var _a; return (_a = this.data.manufacture) === null || _a === void 0 ? void 0 : _a.salesModel; } get serialNumber() { var _a; return (_a = this.data.manufacture) === null || _a === void 0 ? void 0 : _a.serialNo; } get firmwareVersion() { var _a; return (_a = this.data.modemInfo) === null || _a === void 0 ? void 0 : _a.appVersion; } get snapshot() { return this.data.snapshot || null; } set snapshot(value) { this.data.snapshot = value; } get platform() { return this.data.platformType; } get online() { return this.data.online || this.data.snapshot.online; } toString() { return `${this.id}: ${this.name} (${this.type} ${this.model})`; } } exports.Device = Device; //# sourceMappingURL=Device.js.map