diff --git a/rust/src/main.rs b/rust/src/main.rs index 6a71722..9170d5f 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -1,6 +1,5 @@ use std::{ - env, - sync::{atomic::AtomicBool, Arc, Mutex}, + any::Any, env, sync::{atomic::AtomicBool, Arc, Mutex} }; use chrono::{DateTime, Datelike, Duration, NaiveDateTime, Timelike}; @@ -906,6 +905,17 @@ fn update_plant_state(plantstate: &mut [PlantState; PLANT_COUNT], board: &mut st let state = &plantstate[plant]; let plant_config = config.plants[plant]; + let _ = board.mqtt_publish( + &config, + format!("/plant{}/mode", plant+1).as_str(), + match plant_config.mode { + config::Mode::OFF => "OFF".as_bytes(), + config::Mode::TargetMoisture => "TargetMoisture".as_bytes(), + config::Mode::TimerOnly => "TimerOnly".as_bytes(), + config::Mode::TimerAndDeadzone => "TimerAndDeadzone".as_bytes(), + }, + ); + let last_time = board.last_pump_time(plant); let europe_time = last_time.with_timezone(&Berlin); if europe_time.year() > 2023 {