linky
Version:
Easily retrieve your Linky power consumption
68 lines (67 loc) • 1.99 kB
TypeScript
import { AxiosError } from 'axios';
export declare enum DataType {
daily_consumption = "daily_consumption",
consumption_load_curve = "consumption_load_curve",
consumption_max_power = "consumption_max_power",
daily_production = "daily_production",
production_load_curve = "production_load_curve"
}
export type APIResponse = {
usage_point_id: string;
start: string;
end: string;
quality: string;
interval_reading: Array<{
value: string;
date: string;
}>;
reading_type: {
unit: string;
measurement_kind: string;
aggregate: string;
measuring_period?: string;
};
};
export declare class APIError extends Error {
err: AxiosError;
code: string;
response: any;
constructor(err: AxiosError, code: string, response: any);
toString(): string;
}
export type EnergyResponse = APIResponse & {
reading_type: {
unit: 'Wh';
measurement_kind: 'energy';
aggregate: 'sum';
measuring_period: 'P1D';
};
};
export type AveragePowerResponse = APIResponse & {
reading_type: {
unit: 'W';
measurement_kind: 'power';
aggregate: 'average';
};
};
export type MaxPowerResponse = APIResponse & {
reading_type: {
unit: 'VA';
measurement_kind: 'power';
aggregate: 'maximum';
measuring_period: 'P1D';
};
};
export declare class Session {
private token;
private prm?;
private prms;
userAgent: string;
constructor(token: string, prm?: string | undefined);
getDailyConsumption(start: string, end: string): Promise<EnergyResponse>;
getLoadCurve(start: string, end: string): Promise<AveragePowerResponse>;
getMaxPower(start: string, end: string): Promise<MaxPowerResponse>;
getDailyProduction(start: string, end: string): Promise<EnergyResponse>;
getProductionLoadCurve(start: string, end: string): Promise<AveragePowerResponse>;
private callApi;
}