2025-06-14 00:40:47 +02:00

169 lines
3.3 KiB
TypeScript

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,
max_wait: number
}
export interface FileList {
total: number,
used: number,
files: FileInfo[],
file_system_corrupt: string,
iter_error: string,
}
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,
}
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,
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;
}
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,
partition: 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 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
}