cleanups
This commit is contained in:
203
Software/MainBoard/rust/src_webpack/src/api.ts
Normal file
203
Software/MainBoard/rust/src_webpack/src/api.ts
Normal file
@@ -0,0 +1,203 @@
|
||||
export interface LogArray extends Array<LogEntry> {
|
||||
}
|
||||
|
||||
export interface LogEntry {
|
||||
timestamp: string,
|
||||
message_id: number,
|
||||
a: number,
|
||||
b: number,
|
||||
txt_short: string,
|
||||
txt_long: string
|
||||
}
|
||||
|
||||
export interface LogLocalisation extends Array<LogLocalisationEntry> {
|
||||
}
|
||||
|
||||
export interface LogLocalisationEntry {
|
||||
msg_type: string,
|
||||
message: string
|
||||
}
|
||||
|
||||
export interface BackupHeader {
|
||||
timestamp: string,
|
||||
size: number
|
||||
}
|
||||
|
||||
export interface NetworkConfig {
|
||||
ap_ssid: string,
|
||||
ssid: string,
|
||||
password: string,
|
||||
mqtt_url: string,
|
||||
base_topic: string,
|
||||
mqtt_user: string | null,
|
||||
mqtt_password: string | null,
|
||||
max_wait: number
|
||||
}
|
||||
|
||||
export interface FileList {
|
||||
total: number,
|
||||
used: number,
|
||||
files: FileInfo[],
|
||||
file_system_corrupt: string,
|
||||
iter_error: string,
|
||||
}
|
||||
|
||||
export interface SolarState {
|
||||
mppt_voltage: number,
|
||||
mppt_current: number,
|
||||
is_day: boolean
|
||||
}
|
||||
|
||||
export interface FileInfo {
|
||||
filename: string,
|
||||
size: number,
|
||||
}
|
||||
|
||||
export interface NightLampConfig {
|
||||
enabled: boolean,
|
||||
night_lamp_hour_start: number,
|
||||
night_lamp_hour_end: number,
|
||||
night_lamp_only_when_dark: boolean,
|
||||
low_soc_cutoff: number,
|
||||
low_soc_restore: number
|
||||
}
|
||||
|
||||
export interface NightLampCommand {
|
||||
active: boolean
|
||||
}
|
||||
|
||||
export interface TankConfig {
|
||||
tank_sensor_enabled: boolean,
|
||||
tank_allow_pumping_if_sensor_error: boolean,
|
||||
tank_useable_ml: number,
|
||||
tank_warn_percent: number,
|
||||
tank_empty_percent: number,
|
||||
tank_full_percent: number,
|
||||
ml_per_pulse: number
|
||||
}
|
||||
|
||||
|
||||
export enum BatteryBoardVersion {
|
||||
Disabled = "Disabled",
|
||||
BQ34Z100G1 = "BQ34Z100G1",
|
||||
WchI2cSlave = "WchI2cSlave"
|
||||
}
|
||||
|
||||
export enum BoardVersion {
|
||||
INITIAL = "INITIAL",
|
||||
V3 = "V3",
|
||||
V4 = "V4"
|
||||
}
|
||||
|
||||
export interface BoardHardware {
|
||||
board: BoardVersion,
|
||||
battery: BatteryBoardVersion,
|
||||
}
|
||||
|
||||
export interface PlantControllerConfig {
|
||||
hardware: BoardHardware,
|
||||
|
||||
network: NetworkConfig,
|
||||
tank: TankConfig,
|
||||
night_lamp: NightLampConfig,
|
||||
plants: PlantConfig[]
|
||||
timezone?: string,
|
||||
}
|
||||
|
||||
export interface PlantConfig {
|
||||
mode: string,
|
||||
target_moisture: number,
|
||||
min_moisture: number,
|
||||
pump_time_s: number,
|
||||
pump_cooldown_min: number,
|
||||
pump_hour_start: number,
|
||||
pump_hour_end: number,
|
||||
sensor_a: boolean,
|
||||
sensor_b: boolean,
|
||||
max_consecutive_pump_count: number,
|
||||
moisture_sensor_min_frequency: number | null;
|
||||
moisture_sensor_max_frequency: number | null;
|
||||
min_pump_current_ma: number,
|
||||
max_pump_current_ma: number,
|
||||
ignore_current_error: boolean,
|
||||
}
|
||||
|
||||
export interface PumpTestResult {
|
||||
median_current_ma: number,
|
||||
max_current_ma: number,
|
||||
min_current_ma: number,
|
||||
flow_value_ml: number,
|
||||
flow_value_count: number,
|
||||
pump_time_s: number,
|
||||
error: boolean,
|
||||
}
|
||||
|
||||
export interface SSIDList {
|
||||
ssids: [string]
|
||||
}
|
||||
|
||||
export interface TestPump {
|
||||
pump: number
|
||||
}
|
||||
|
||||
export interface SetTime {
|
||||
time: string
|
||||
}
|
||||
|
||||
export interface GetTime {
|
||||
rtc: string,
|
||||
native: string
|
||||
}
|
||||
|
||||
export interface Moistures {
|
||||
moisture_a: [string],
|
||||
moisture_b: [string],
|
||||
}
|
||||
|
||||
export interface VersionInfo {
|
||||
git_hash: string,
|
||||
build_time: string,
|
||||
current: string,
|
||||
slot0_state: string,
|
||||
slot1_state: string,
|
||||
}
|
||||
|
||||
export interface BatteryState {
|
||||
temperature: string
|
||||
voltage_milli_volt: string,
|
||||
current_milli_ampere: string,
|
||||
cycle_count: string,
|
||||
design_milli_ampere: string,
|
||||
remaining_milli_ampere: string,
|
||||
state_of_charge: string,
|
||||
state_of_health: string
|
||||
}
|
||||
|
||||
export interface DetectionPlant {
|
||||
a: boolean,
|
||||
b: boolean
|
||||
}
|
||||
|
||||
export interface DetectionResult {
|
||||
plants: DetectionPlant[]
|
||||
}
|
||||
|
||||
export interface TankInfo {
|
||||
/// is there enough water in the tank
|
||||
enough_water: boolean,
|
||||
/// warning that water needs to be refilled soon
|
||||
warn_level: boolean,
|
||||
/// estimation how many ml are still in tank
|
||||
left_ml: number | null,
|
||||
/// if there is was an issue with the water level sensor
|
||||
sensor_error: string | null,
|
||||
/// raw water sensor value
|
||||
raw: number | null,
|
||||
/// percent value
|
||||
percent: number | null,
|
||||
/// water in tank might be frozen
|
||||
water_frozen: boolean,
|
||||
/// water temperature
|
||||
water_temp: number | null,
|
||||
temp_sensor_error: string | null
|
||||
}
|
||||
Reference in New Issue
Block a user