5 Commits

Author SHA1 Message Date
55bcc0c52f move all mqtt publishing functions to mqtt module 2026-05-10 19:48:04 +02:00
54a2f2d9e5 refctor: TankInfo structure (consistent layout)
- fix: use tagged enum serialization for TankError
- fix: rename TankInfo fields for consistent naming (volume_ml, pct, water_temp_c)
- renamed some fields for better clarity on contained value
2026-05-10 19:48:02 +02:00
ba5159708f refactor: PlantInfo structure (consistent layout)
- fix: use tagged enum serialization for MoistureSensorError and PumpError
- fix: flatten PlantInfo sensors to SensorTelemetry with top-level moisture_pct
2026-05-10 19:48:00 +02:00
2df120f73b refactor: BatteryInfo structure (consistent layout)
- use tagged enum serialization for BatteryError
- flatten BatteryInfo telemetry with consistent field names and typed error
2026-05-10 19:47:58 +02:00
58aa55fd12 fix: serialize firmware/state as JSON instead of Debug format 2026-05-10 19:47:56 +02:00
2 changed files with 4 additions and 5 deletions

View File

@@ -415,10 +415,10 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
.get_esp()
.store_last_pump_time(plant_id, cur);
board.board_hal.get_esp().last_pump_time(plant_id);
mqtt::pump_info(plant_id, true, pump_ineffective, 0, 0, 0, false).await;
pump_info(plant_id, true, pump_ineffective, 0, 0, 0, false).await;
let result = do_secure_pump(&mut board, plant_id, plant_config, dry_run).await?;
board.board_hal.pump(plant_id, false).await?;
mqtt::pump_info(
pump_info(
plant_id,
false,
pump_ineffective,
@@ -561,8 +561,7 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
if stay_alive {
let reboot_now = Arc::new(AtomicBool::new(false));
spawner.spawn(http_server(reboot_now.clone(), stack.take().unwrap())?);
let _webserver = http_server(reboot_now.clone(), stack.take().unwrap());
wait_infinity(board, WaitType::MqttConfig, reboot_now.clone(), UTC).await;
} else {
//TODO wait for all mqtt publishes?

View File

@@ -300,7 +300,7 @@ impl PlantState {
false
},
cooldown: self.pump_in_timeout(plant_conf, current_time),
out_of_work_hour: !in_time_range(
out_of_work_hour: in_time_range(
current_time,
plant_conf.pump_hour_start,
plant_conf.pump_hour_end,