Add select for relays
This commit is contained in:
@ -12,8 +12,10 @@ export interface DailyMinRuntime {
|
||||
catch_up_hours: number[];
|
||||
}
|
||||
|
||||
export type RelayID = string;
|
||||
|
||||
export interface DeviceRelay {
|
||||
id: string;
|
||||
id: RelayID;
|
||||
name: string;
|
||||
enabled: boolean;
|
||||
priority: number;
|
||||
@ -21,8 +23,8 @@ export interface DeviceRelay {
|
||||
minimal_uptime: number;
|
||||
minimal_downtime: number;
|
||||
daily_runtime?: DailyMinRuntime;
|
||||
depends_on: DeviceRelay[];
|
||||
conflicts_with: DeviceRelay[];
|
||||
depends_on: RelayID[];
|
||||
conflicts_with: RelayID[];
|
||||
}
|
||||
|
||||
export interface Device {
|
||||
|
16
central_frontend/src/api/RelayApi.ts
Normal file
16
central_frontend/src/api/RelayApi.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { APIClient } from "./ApiClient";
|
||||
import { DeviceRelay } from "./DeviceApi";
|
||||
|
||||
export class RelayApi {
|
||||
/**
|
||||
* Get the full list of relays
|
||||
*/
|
||||
static async GetList(): Promise<DeviceRelay[]> {
|
||||
return (
|
||||
await APIClient.exec({
|
||||
method: "GET",
|
||||
uri: "/relays/list",
|
||||
})
|
||||
).data;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user