v4 board impl

This commit is contained in:
2025-06-14 00:40:47 +02:00
parent 6499b18ada
commit 05400c7c4a
21 changed files with 471 additions and 116 deletions

View File

@@ -1,6 +1,6 @@
interface LogArray extends Array<LogEntry>{}
export interface LogArray extends Array<LogEntry>{}
interface LogEntry {
export interface LogEntry {
timestamp: string,
message_id: number,
a: number,
@@ -9,27 +9,28 @@ interface LogEntry {
txt_long: string
}
interface LogLocalisation extends Array<LogLocalisationEntry>{}
export interface LogLocalisation extends Array<LogLocalisationEntry>{}
interface LogLocalisationEntry {
export interface LogLocalisationEntry {
msg_type: string,
message: string
}
interface BackupHeader {
export interface BackupHeader {
timestamp: string,
size: number
}
interface NetworkConfig {
export interface NetworkConfig {
ap_ssid: string,
ssid: string,
password: string,
mqtt_url: string,
base_topic: string
base_topic: string,
max_wait: number
}
interface FileList {
export interface FileList {
total: number,
used: number,
files: FileInfo[],
@@ -37,12 +38,12 @@ interface FileList {
iter_error: string,
}
interface FileInfo{
export interface FileInfo{
filename: string,
size: number,
}
interface NightLampConfig {
export interface NightLampConfig {
enabled: boolean,
night_lamp_hour_start: number,
night_lamp_hour_end: number,
@@ -51,11 +52,11 @@ interface NightLampConfig {
low_soc_restore: number
}
interface NightLampCommand {
export interface NightLampCommand {
active: boolean
}
interface TankConfig {
export interface TankConfig {
tank_sensor_enabled: boolean,
tank_allow_pumping_if_sensor_error: boolean,
tank_useable_ml: number,
@@ -64,7 +65,26 @@ interface TankConfig {
tank_full_percent: number,
}
interface PlantControllerConfig {
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,
@@ -72,7 +92,7 @@ interface PlantControllerConfig {
timezone?: string,
}
interface PlantConfig {
export interface PlantConfig {
mode: string,
target_moisture: number,
pump_time_s: number,
@@ -88,35 +108,35 @@ interface PlantConfig {
}
interface SSIDList {
export interface SSIDList {
ssids: [string]
}
interface TestPump {
export interface TestPump {
pump: number
}
interface SetTime {
export interface SetTime {
time: string
}
interface GetTime {
export interface GetTime {
rtc: string,
native: string
}
interface Moistures {
export interface Moistures {
moisture_a: [string],
moisture_b: [string],
}
interface VersionInfo {
export interface VersionInfo {
git_hash: string,
build_time: string,
partition: string
}
interface BatteryState {
export interface BatteryState {
temperature: string
voltage_milli_volt: string,
current_milli_ampere: string,
@@ -127,7 +147,7 @@ interface BatteryState {
state_of_health: string
}
interface TankInfo {
export interface TankInfo {
/// is there enough water in the tank
enough_water: boolean,
/// warning that water needs to be refilled soon
@@ -145,4 +165,4 @@ interface TankInfo {
/// water temperature
water_temp: number | null,
temp_sensor_error: string | null
}
}