Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

homebridge-flair

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-flair - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

6

dist/platform.d.ts

@@ -18,5 +18,7 @@ import type { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig } from 'homebridge';

private rooms;
private hasValidConfig;
private _hasValidConfig?;
private _hasValidCredentials?;
constructor(log: Logger, config: PlatformConfig, api: API);
private validConfig;
private checkCredentials;
private getNewStructureReadings;

@@ -30,3 +32,3 @@ private updateStructureFromStructureReading;

*/
configureAccessory(accessory: PlatformAccessory): void;
configureAccessory(accessory: PlatformAccessory): Promise<void>;
/**

@@ -33,0 +35,0 @@ * This is an example method showing how to register discovered accessories.

@@ -26,7 +26,4 @@ "use strict";

this.rooms = [];
this.hasValidConfig = false;
this.log.debug('Finished initializing platform:', this.config.name);
this.hasValidConfig = this.validConfig();
if (!this.hasValidConfig) {
this.log.error('The Flair config is not valid, please ensure your config has all necessary settings.');
if (!this.validConfig()) {
return;

@@ -40,6 +37,8 @@ }

this.api.on("didFinishLaunching" /* DID_FINISH_LAUNCHING */, async () => {
if (!this.hasValidConfig) {
if (!this.validConfig()) {
return;
}
log.debug('Executed didFinishLaunching callback');
if (!(await this.checkCredentials())) {
return;
}
// run the method to discover / register your devices as accessories

@@ -53,20 +52,41 @@ await this.discoverDevices();

validConfig() {
if (this._hasValidConfig !== undefined) {
return this._hasValidConfig;
}
this._hasValidConfig = true;
if (!this.config.clientId) {
this.log.error('You need to enter a Flair Client Id');
return false;
this._hasValidConfig = false;
}
if (!this.config.clientSecret) {
this.log.error('You need to enter a Flair Client Id');
return false;
this._hasValidConfig = false;
}
if (!this.config.username) {
this.log.error('You need to enter your flair username');
return false;
this._hasValidConfig = false;
}
if (!this.config.password) {
this.log.error('You need to enter your flair password');
return false;
this._hasValidConfig = false;
}
return true;
if (this._hasValidConfig === undefined) {
this._hasValidConfig = true;
}
return this._hasValidConfig;
}
async checkCredentials() {
if (this._hasValidCredentials !== undefined) {
return this._hasValidCredentials;
}
this._hasValidCredentials = false;
try {
await this.client.getUsers();
this._hasValidCredentials = true;
}
catch (e) {
this.log.error('Error getting structure readings this is usually incorrect credentials, ensure you entered the right credentials.');
}
return this._hasValidCredentials;
}
async getNewStructureReadings() {

@@ -114,6 +134,9 @@ try {

*/
configureAccessory(accessory) {
if (!this.hasValidConfig) {
async configureAccessory(accessory) {
if (!this.validConfig()) {
return;
}
if (!(await this.checkCredentials())) {
return;
}
this.log.info('Restoring accessory from cache:', accessory.displayName);

@@ -120,0 +143,0 @@ if (accessory.context.type === flair_api_ts_1.Puck.type) {

{
"displayName": "Homebridge Flair",
"name": "homebridge-flair",
"version": "1.2.3",
"version": "1.2.4",
"publishConfig": {

@@ -6,0 +6,0 @@ "registry": "https://registry.npmjs.org/"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc