Show current consumption chart
This commit is contained in:
@ -2,9 +2,9 @@ import { APIClient } from "./ApiClient";
|
||||
|
||||
export class EnergyApi {
|
||||
/**
|
||||
* Get current house consumption
|
||||
* Get current grid consumption
|
||||
*/
|
||||
static async CurrConsumption(): Promise<number> {
|
||||
static async GridConsumption(): Promise<number> {
|
||||
const data = await APIClient.exec({
|
||||
method: "GET",
|
||||
uri: "/energy/curr_consumption",
|
||||
@ -12,6 +12,18 @@ export class EnergyApi {
|
||||
return data.data.consumption;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get grid consumption history
|
||||
*/
|
||||
static async GridConsumptionHistory(): Promise<number[]> {
|
||||
return (
|
||||
await APIClient.exec({
|
||||
method: "GET",
|
||||
uri: "/energy/curr_consumption/history",
|
||||
})
|
||||
).data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current cached consumption
|
||||
*/
|
||||
@ -22,4 +34,16 @@ export class EnergyApi {
|
||||
});
|
||||
return data.data.consumption;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get relays consumption history
|
||||
*/
|
||||
static async RelaysConsumptionHistory(): Promise<number[]> {
|
||||
return (
|
||||
await APIClient.exec({
|
||||
method: "GET",
|
||||
uri: "/energy/relays_consumption/history",
|
||||
})
|
||||
).data;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user