Add is_on functions

This commit is contained in:
Tobias Reisinger 2024-04-24 03:03:21 +02:00
parent 6414083af0
commit 0460e838bc
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 32 additions and 2 deletions
emgauwa-controller/src

View file

@ -50,10 +50,17 @@ async fn run_relays(app_state: &Addr<AppState>) -> Result<(), EmgauwaError> {
}
let mut relay_debug = String::new();
let now = Local::now().time();
for relay in this.relays.iter() {
relay_debug.push_str(&format!(
"{}: {} |",
relay.r.name, relay.active_schedule.name
"{}{}: {} ; ",
if relay.active_schedule.is_on(&now) {
"+"
} else {
"-"
},
relay.r.name,
relay.active_schedule.name
));
}
log::debug!(