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);
|
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue