@homebridge-plugins/homebridge-air
Version:
The AirNow plugin allows you to monitor the current AirQuality for your Zip Code from HomeKit and Siri.
175 lines • 4.88 kB
TypeScript
import type { PlatformConfig } from 'homebridge';
/**
* This is the name of the platform that users will use to register the plugin in the Homebridge config.json
*/
export declare const PLATFORM_NAME = "Air";
/**
* This must match the name of your plugin as defined the package.json
*/
export declare const PLUGIN_NAME = "@homebridge-plugins/homebridge-air";
/**
* This must match the name of your plugin as defined the package.json
*/
export declare const AirNowUrl = "https://www.airnowapi.org/aq/observation/";
export declare const AqicnUrl = "https://api.waqi.info/feed/";
/**
* HTTP Request Timeout Configuration Constants (in milliseconds)
*/
export declare const REQUEST_TIMEOUT_CONFIG: {
/** Default timeout for HTTP requests - monitors time between receiving body data */
readonly DEFAULT_TIMEOUT: 30000;
/** Maximum timeout between retries */
readonly MAX_RETRY_TIMEOUT: 30000;
/** Initial timeout for the first retry attempt */
readonly MIN_RETRY_TIMEOUT: 500;
/** Socket idle timeout - time after which inactive sockets timeout */
readonly IDLE_TIMEOUT: 4000;
/** Timeout used for reverse geocoding lookup requests */
readonly GEOCODE_TIMEOUT: 10000;
/** Timeout used by Node family auto-selection attempt before fallback */
readonly AUTO_SELECT_FAMILY_ATTEMPT_TIMEOUT: 250;
};
/**
* Request throttling and cache constants used by both HAP and Matter polling paths.
*/
export declare const REQUEST_RATE_LIMIT_CONFIG: {
/** Cache successful API responses for 10 minutes. */
readonly CACHE_MAX_AGE: 600000;
/** Track call counts in 1 hour windows. */
readonly CALL_WINDOW_MS: 3600000;
/** Conservative call cap to reduce provider throttling. */
readonly MAX_CALLS_PER_WINDOW: 60;
};
export interface AirPlatformConfig extends PlatformConfig {
name?: string;
devices?: devicesConfig[];
options?: options;
}
export interface devicesConfig {
provider: string;
apiKey?: string;
latitude?: number;
longitude?: number;
city?: string;
state?: string;
zipCode?: string;
distance?: string;
firmware: string;
refreshRate?: number;
updateRate?: number;
pushRate?: number;
logging?: string;
hide_device?: boolean;
}
export interface options {
allowInvalidCharacters?: boolean;
refreshRate?: number;
updateRate?: number;
pushRate?: number;
logging?: string;
enableMatter?: boolean;
preferMatter?: boolean;
}
interface Category {
Number: number;
Name: string;
}
interface AirNowAirQualityData {
DateObserved: string;
HourObserved: number;
LocalTimeZone: string;
ReportingArea: string;
StateCode: string;
Latitude: number;
Longitude: number;
ParameterName: string;
AQI: number;
Category: Category;
}
export type AirNowAirQualityDataArray = AirNowAirQualityData[];
/**
* Build the AQICN location segment for /feed/<segment> requests.
*
* Priority:
* 1) explicit station/city path (or full AQICN URL) from city field
* 2) geo:lat;lon when coordinates are provided
* 3) plain city value
*/
export declare function resolveAqicnLocationSegment(device: Pick<devicesConfig, 'city' | 'latitude' | 'longitude'>): string;
export interface AqicnData {
status: string;
data: {
idx: number;
aqi: number;
time: {
s: string;
tz: string;
};
city: {
name: string;
geo: [number, number];
url: string;
};
attributions: {
name: string;
url: string;
}[];
iaqi: {
pm25?: {
v: number;
};
pm10?: {
v: number;
};
o3?: {
v: number;
};
no2?: {
v: number;
};
so2?: {
v: number;
};
co?: {
v: number;
};
dew?: {
v: number;
};
h?: {
v: number;
};
p?: {
v: number;
};
t?: {
v: number;
};
w?: {
v: number;
};
wg?: {
v: number;
};
};
forecast: {
daily: {
pm25: {
v: number;
}[];
pm10: {
v: number;
}[];
o3: {
v: number;
}[];
uvi: {
v: number;
}[];
};
};
};
}
export declare function HomeKitAQI(aqi: number | undefined): number;
export {};
//# sourceMappingURL=settings.d.ts.map