1
0
Fork 0

Added debug statements

This commit is contained in:
Alexander Böhm 2024-01-05 16:08:31 +01:00
parent df2a35f4d3
commit 189528591e
1 changed files with 5 additions and 8 deletions

View File

@ -50,7 +50,7 @@ async fn main() {
log::debug!("Pushing space status: Open = {}", door_status_new); log::debug!("Pushing space status: Open = {}", door_status_new);
let _ = push_door_status(&spaceapi_client, door_status_new) let _ = push_door_status(&spaceapi_client, door_status_new)
.await .await
.map_err(|err| format!("Problem while pushing door status: {err}")) ; .map_err(|err| format!("Problem while pushing door status: {err}"));
log::debug!("Saving space status: {}", door_status_new); log::debug!("Saving space status: {}", door_status_new);
door_status_old = door_status_new; door_status_old = door_status_new;
} else { } else {
@ -67,13 +67,10 @@ fn check_door(pin: &InputPin) -> bool {
async fn push_door_status(spaceapi: &Client, open: bool) -> Result<(), String> { async fn push_door_status(spaceapi: &Client, open: bool) -> Result<(), String> {
if open { if open {
spaceapi log::debug!("Sending keep open to server");
.keep_open() spaceapi.keep_open().await.map(|_| ())
.await
.map(|_| ())
} else { } else {
spaceapi log::debug!("Sending explicit close to server");
.close() spaceapi.close().await
.await
} }
} }