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

homebridge-air

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-air - npm Package Compare versions

Comparing version 1.0.0-beta.14 to 1.0.0-beta.15

4

config.schema.json

@@ -155,3 +155,3 @@ {

},
"delete": {
"hide_device": {
"title": "Delete Device",

@@ -229,3 +229,3 @@ "type": "boolean",

"devices[].logging",
"devices[].delete"
"devices[].hide_device"
]

@@ -232,0 +232,0 @@ },

@@ -44,5 +44,4 @@ import { interval } from 'rxjs';

this.refreshStatus();
this.updateHomeKitCharacteristics();
// Start an update interval
interval(this.deviceRefreshRate * 1000)
interval(this.deviceRefreshRate * 10000)
.pipe(skipWhile(() => this.SensorUpdateInProgress))

@@ -49,0 +48,0 @@ .subscribe(async () => {

@@ -14,6 +14,9 @@ import type { API, CharacteristicValue, HAP, Logging, PlatformAccessory, Service } from 'homebridge';

protected deviceRefreshRate: number;
protected deviceUpdateRate: number;
protected devicePushRate: number;
protected deviceFirmwareVersion: string;
constructor(platform: AirPlatform, accessory: PlatformAccessory, device: devicesConfig);
getDeviceLogSettings(accessory: PlatformAccessory, device: devicesConfig): Promise<void>;
getDeviceRateSettings(accessory: PlatformAccessory, device: devicesConfig): Promise<void>;
getDeviceConfigSettings(accessory: PlatformAccessory, device: devicesConfig): Promise<void>;
getDeviceLogSettings(device: devicesConfig): Promise<void>;
getDeviceRateSettings(device: devicesConfig): Promise<void>;
getDeviceConfigSettings(device: devicesConfig): Promise<void>;
getDeviceContext(accessory: PlatformAccessory, device: devicesConfig): Promise<void>;

@@ -20,0 +23,0 @@ /**

@@ -12,2 +12,5 @@ export class deviceBase {

deviceRefreshRate;
deviceUpdateRate;
devicePushRate;
deviceFirmwareVersion;
constructor(platform, accessory, device) {

@@ -21,5 +24,5 @@ this.platform = platform;

this.hap = this.api.hap;
this.getDeviceLogSettings(accessory, device);
this.getDeviceRateSettings(accessory, device);
this.getDeviceConfigSettings(accessory, device);
this.getDeviceLogSettings(device);
this.getDeviceRateSettings(device);
this.getDeviceConfigSettings(device);
this.getDeviceContext(accessory, device);

@@ -34,20 +37,26 @@ // Set accessory information

.setCharacteristic(this.hap.Characteristic.SerialNumber, accessory.context.serialNumber)
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.deviceFirmwareVersion)
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
.updateValue(accessory.context.FirmwareRevision);
.updateValue(this.deviceFirmwareVersion);
}
async getDeviceLogSettings(accessory, device) {
async getDeviceLogSettings(device) {
this.deviceLogging = this.platform.debugMode ? 'debugMode' : device.logging ?? this.platform.platformLogging ?? 'standard';
const logging = this.platform.debugMode ? 'Debug Mode' : device.logging ? 'Device Config' : this.platform.platformLogging ? 'Platform Config' : 'Default';
accessory.context.deviceLogging = this.deviceLogging;
await this.debugLog(`Using ${logging} Logging: ${this.deviceLogging}`);
}
async getDeviceRateSettings(accessory, device) {
async getDeviceRateSettings(device) {
// refreshRate
this.deviceRefreshRate = device.refreshRate ?? this.platform.platformRefreshRate ?? 3600;
accessory.context.deviceRefreshRate = this.deviceRefreshRate;
const refreshRate = device.refreshRate ? 'Device Config' : this.platform.platformRefreshRate ? 'Platform Config' : 'Default';
await this.debugLog(`Using ${refreshRate} Refresh Rate: ${this.deviceRefreshRate}`);
await this.debugLog(`Using ${refreshRate} refreshRate: ${this.deviceRefreshRate}`);
// updateRate
this.deviceUpdateRate = device.updateRate ?? this.platform.platformUpdateRate ?? 5;
const updateRate = device.updateRate ? 'Device Config' : this.platform.platformUpdateRate ? 'Platform Config' : 'Default';
await this.debugLog(`Using ${updateRate} updateRate: ${this.deviceUpdateRate}`);
// pushRate
this.devicePushRate = device.pushRate ?? this.platform.platformPushRate ?? 1;
const pushRate = device.pushRate ? 'Device Config' : this.platform.platformPushRate ? 'Platform Config' : 'Default';
await this.debugLog(`Using ${pushRate} pushRate: ${this.devicePushRate}`);
}
async getDeviceConfigSettings(accessory, device) {
async getDeviceConfigSettings(device) {
const deviceConfig = {};

@@ -57,3 +66,5 @@ const properties = [

'refreshRate',
'delete',
'updateRate',
'pushRate',
'hide_device',
];

@@ -68,9 +79,7 @@ properties.forEach((prop) => {

}
accessory.context.deviceConfig = deviceConfig;
}
async getDeviceContext(accessory, device) {
const deviceFirmwareVersion = device.firmware ?? accessory.context.version ?? this.platform.version ?? '0.0.0';
const deviceFirmwareVersion = device.firmware ?? this.platform.version ?? '0.0.0';
const version = deviceFirmwareVersion.toString();
this.debugLog(`Firmware Version: ${version.replace(/^V|-.*$/g, '')}`);
let deviceVersion;
if (version?.includes('.') === false) {

@@ -80,16 +89,15 @@ const replace = version?.replace(/^V|-.*$/g, '');

const validVersion = match?.join('.');
deviceVersion = validVersion ?? '0.0.0';
this.deviceFirmwareVersion = validVersion ?? '0.0.0';
}
else {
deviceVersion = version.replace(/^V|-.*$/g, '') ?? '0.0.0';
this.deviceFirmwareVersion = version.replace(/^V|-.*$/g, '') ?? '0.0.0';
}
accessory
.getService(this.hap.Service.AccessoryInformation)
.setCharacteristic(this.hap.Characteristic.HardwareRevision, deviceVersion)
.setCharacteristic(this.hap.Characteristic.SoftwareRevision, deviceVersion)
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
.setCharacteristic(this.hap.Characteristic.HardwareRevision, this.deviceFirmwareVersion)
.setCharacteristic(this.hap.Characteristic.SoftwareRevision, this.deviceFirmwareVersion)
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, this.deviceFirmwareVersion)
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
.updateValue(deviceVersion);
accessory.context.FirmwareRevision = deviceVersion;
this.debugSuccessLog(`FirmwareRevision: ${accessory.context.version}`);
.updateValue(this.deviceFirmwareVersion);
this.debugSuccessLog(`deviceFirmwareVersion: ${this.deviceFirmwareVersion}`);
}

@@ -96,0 +104,0 @@ /**

@@ -38,5 +38,5 @@ import type { API, DynamicPlatformPlugin, HAP, Logging, PlatformAccessory } from 'homebridge';

unregisterPlatformAccessories(existingAccessory: PlatformAccessory): Promise<void>;
getPlatformLogSettings(): Promise<void>;
getPlatformRateSettings(): Promise<void>;
getPlatformConfigSettings(): Promise<void>;
getPlatformRateSettings(): Promise<void>;
getPlatformLogSettings(): Promise<void>;
/**

@@ -43,0 +43,0 @@ * Asynchronously retrieves the version of the plugin from the package.json file.

@@ -158,3 +158,3 @@ import { readFileSync } from 'node:fs';

// the accessory already exists
if (!device.delete) {
if (!device.hide_device) {
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:

@@ -178,3 +178,3 @@ existingAccessory.context.device = device;

}
else if (!device.delete && !existingAccessory) {
else if (!device.hide_device && !existingAccessory) {
// create a new accessory

@@ -208,2 +208,25 @@ const accessory = new this.api.platformAccessory(device.city, uuid);

}
async getPlatformLogSettings() {
this.debugMode = argv.includes('-D') ?? argv.includes('--debug');
this.platformLogging = (this.config.options?.logging === 'debug' || this.config.options?.logging === 'standard'
|| this.config.options?.logging === 'none')
? this.config.options.logging
: this.debugMode ? 'debugMode' : 'standard';
const logging = this.config.options?.logging ? 'Platform Config' : this.debugMode ? 'debugMode' : 'Default';
await this.debugLog(`Using ${logging} Logging: ${this.platformLogging}`);
}
async getPlatformRateSettings() {
// RefreshRate
this.platformRefreshRate = this.config.options?.refreshRate ? this.config.options.refreshRate : undefined;
const refreshRate = this.config.options?.refreshRate ? 'Using Platform Config refreshRate' : 'Platform Config refreshRate Not Set';
await this.debugLog(`${refreshRate}: ${this.platformRefreshRate}`);
// UpdateRate
this.platformUpdateRate = this.config.options?.updateRate ? this.config.options.updateRate : undefined;
const updateRate = this.config.options?.updateRate ? 'Using Platform Config updateRate' : 'Platform Config updateRate Not Set';
await this.debugLog(`${updateRate}: ${this.platformUpdateRate}`);
// PushRate
this.platformPushRate = this.config.options?.pushRate ? this.config.options.pushRate : undefined;
const pushRate = this.config.options?.pushRate ? 'Using Platform Config pushRate' : 'Platform Config pushRate Not Set';
await this.debugLog(`${pushRate}: ${this.platformPushRate}`);
}
async getPlatformConfigSettings() {

@@ -224,22 +247,2 @@ if (this.config.options) {

}
async getPlatformRateSettings() {
this.platformRefreshRate = this.config.options?.refreshRate ? this.config.options.refreshRate : 0;
const refreshRate = this.config.options?.refreshRate ? 'Using Platform Config refreshRate' : 'refreshRate Disabled by Default';
await this.debugLog(`${refreshRate}: ${this.platformRefreshRate}`);
this.platformUpdateRate = this.config.options?.updateRate ? this.config.options.updateRate : 1;
const updateRate = this.config.options?.updateRate ? 'Using Platform Config updateRate' : 'Using Default updateRate';
await this.debugLog(`${updateRate}: ${this.platformUpdateRate}`);
this.platformPushRate = this.config.options?.pushRate ? this.config.options.pushRate : 1;
const pushRate = this.config.options?.pushRate ? 'Using Platform Config pushRate' : 'Using Default pushRate';
await this.debugLog(`${pushRate}: ${this.platformPushRate}`);
}
async getPlatformLogSettings() {
this.debugMode = argv.includes('-D') ?? argv.includes('--debug');
this.platformLogging = (this.config.options?.logging === 'debug' || this.config.options?.logging === 'standard'
|| this.config.options?.logging === 'none')
? this.config.options.logging
: this.debugMode ? 'debugMode' : 'standard';
const logging = this.config.options?.logging ? 'Platform Config' : this.debugMode ? 'debugMode' : 'Default';
await this.debugLog(`Using ${logging} Logging: ${this.platformLogging}`);
}
/**

@@ -246,0 +249,0 @@ * Asynchronously retrieves the version of the plugin from the package.json file.

@@ -31,4 +31,6 @@ import { type PlatformConfig } from 'homebridge';

refreshRate?: number;
updateRate?: number;
pushRate?: number;
logging?: string;
delete?: boolean;
hide_device?: boolean;
}

@@ -35,0 +37,0 @@ export interface options {

@@ -5,3 +5,3 @@ {

"type": "module",
"version": "1.0.0-beta.14",
"version": "1.0.0-beta.15",
"description": "The AirNow plugin allows you to monitor the current AirQuality for your Zip Code from HomeKit and Siri.",

@@ -78,3 +78,3 @@ "author": {

"@types/mdast": "^4.0.4",
"@types/node": "^22.8.7",
"@types/node": "^22.9.0",
"@types/semver": "^7.5.8",

@@ -81,0 +81,0 @@ "@types/source-map-support": "^0.5.10",

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

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