also print mode to mqtt
This commit is contained in:
parent
556e64740a
commit
57a0971c4b
@ -1,6 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
env,
|
any::Any, env, sync::{atomic::AtomicBool, Arc, Mutex}
|
||||||
sync::{atomic::AtomicBool, Arc, Mutex},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use chrono::{DateTime, Datelike, Duration, NaiveDateTime, Timelike};
|
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 state = &plantstate[plant];
|
||||||
let plant_config = config.plants[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 last_time = board.last_pump_time(plant);
|
||||||
let europe_time = last_time.with_timezone(&Berlin);
|
let europe_time = last_time.with_timezone(&Berlin);
|
||||||
if europe_time.year() > 2023 {
|
if europe_time.year() > 2023 {
|
||||||
|
Loading…
Reference in New Issue
Block a user