homebridge-xfinityhome
Version:
A homebridge plugin to control your Xfinity Home security system.
29 lines • 1.41 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Accessory_1 = __importDefault(require("./Accessory"));
class UnknownAccessory extends Accessory_1.default {
constructor(platform, accessory, device) {
super(platform, accessory, device, accessory.getService(platform.Service.AccessoryInformation));
this.platform = platform;
this.accessory = accessory;
this.device = device;
if (!this.platform.config.hideUnsupportedDeviceWarnings) {
this.log('warn', 'Unknown accessory!');
this.log('warn', 'Please open an issue about this.');
this.log('warn', JSON.stringify(this.device.device, null, 2));
}
this.device.onchange = async (_oldState, newState) => {
/** Normally not updated until AFTER `onchange` function execution */
this.device.device = newState;
this.accessory.context.logPath = this.logPath;
this.accessory.context.device = newState;
this.accessory.context.refreshToken = this.platform.xhome.refreshToken;
this.platform.api.updatePlatformAccessories([this.accessory]);
};
}
}
exports.default = UnknownAccessory;
//# sourceMappingURL=UnknownAccessory.js.map