forked from moke/spaceapi-tuerpie-nix
Added debug statements
This commit is contained in:
parent
df2a35f4d3
commit
189528591e
13
src/main.rs
13
src/main.rs
|
@ -50,7 +50,7 @@ async fn main() {
|
|||
log::debug!("Pushing space status: Open = {}", door_status_new);
|
||||
let _ = push_door_status(&spaceapi_client, door_status_new)
|
||||
.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);
|
||||
door_status_old = door_status_new;
|
||||
} else {
|
||||
|
@ -67,13 +67,10 @@ fn check_door(pin: &InputPin) -> bool {
|
|||
|
||||
async fn push_door_status(spaceapi: &Client, open: bool) -> Result<(), String> {
|
||||
if open {
|
||||
spaceapi
|
||||
.keep_open()
|
||||
.await
|
||||
.map(|_| ())
|
||||
log::debug!("Sending keep open to server");
|
||||
spaceapi.keep_open().await.map(|_| ())
|
||||
} else {
|
||||
spaceapi
|
||||
.close()
|
||||
.await
|
||||
log::debug!("Sending explicit close to server");
|
||||
spaceapi.close().await
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue