Add select for relays

This commit is contained in:
2024-07-30 22:54:47 +02:00
parent 596d22739d
commit 3004b03d92
4 changed files with 103 additions and 4 deletions

View File

@ -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 {

View 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;
}
}