Updated some logging stuff
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dreaded_X 2023-08-15 23:06:09 +02:00
parent 27ef78e132
commit ab5e47d1ff
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4
2 changed files with 10 additions and 10 deletions

View File

@ -175,10 +175,10 @@ impl OnOff for HueLight {
Ok(res) => { Ok(res) => {
let status = res.status(); let status = res.status();
if !status.is_success() { if !status.is_success() {
warn!(self.identifier, "Status code is not success: {status}"); warn!(id = self.identifier, "Status code is not success: {status}");
} }
} }
Err(err) => error!(self.identifier, "Error: {err}"), Err(err) => error!(id = self.identifier, "Error: {err}"),
} }
Ok(()) Ok(())
@ -196,14 +196,14 @@ impl OnOff for HueLight {
Ok(res) => { Ok(res) => {
let status = res.status(); let status = res.status();
if !status.is_success() { if !status.is_success() {
warn!(self.identifier, "Status code is not success: {status}"); warn!(id = self.identifier, "Status code is not success: {status}");
} }
let v: Value = serde_json::from_slice(res.bytes().await.unwrap().as_ref()).unwrap(); let v: Value = serde_json::from_slice(res.bytes().await.unwrap().as_ref()).unwrap();
// TODO: This is not very nice // TODO: This is not very nice
return Ok(v["state"]["on"].as_bool().unwrap()); return Ok(v["state"]["on"].as_bool().unwrap());
} }
Err(err) => error!(self.identifier, "Error: {err}"), Err(err) => error!(id = self.identifier, "Error: {err}"),
} }
Ok(false) Ok(false)
@ -226,7 +226,7 @@ impl Timeout for HueLight {
let hours = timeout.as_secs() / 3600; let hours = timeout.as_secs() / 3600;
let time = format!("PT{hours:<02}:{minutes:<02}:{seconds:<02}"); let time = format!("PT{hours:<02}:{minutes:<02}:{seconds:<02}");
debug!(self.identifier, "Starting timeout ({time})..."); debug!(id = self.identifier, "Starting timeout ({time})...");
let res = reqwest::Client::new() let res = reqwest::Client::new()
.put(url) .put(url)
@ -238,10 +238,10 @@ impl Timeout for HueLight {
Ok(res) => { Ok(res) => {
let status = res.status(); let status = res.status();
if !status.is_success() { if !status.is_success() {
warn!(self.identifier, "Status code is not success: {status}"); warn!(id = self.identifier, "Status code is not success: {status}");
} }
} }
Err(err) => error!(self.identifier, "Error: {err}"), Err(err) => error!(id = self.identifier, "Error: {err}"),
} }
} }
@ -261,10 +261,10 @@ impl Timeout for HueLight {
Ok(res) => { Ok(res) => {
let status = res.status(); let status = res.status();
if !status.is_success() { if !status.is_success() {
warn!(self.identifier, "Status code is not success: {status}"); warn!(id = self.identifier, "Status code is not success: {status}");
} }
} }
Err(err) => error!(self.identifier, "Error: {err}"), Err(err) => error!(id = self.identifier, "Error: {err}"),
} }
} }
} }

View File

@ -80,7 +80,7 @@ impl OnMqtt for Washer {
} }
}; };
debug!(id = self.identifier, power, "Washer state update"); // debug!(id = self.identifier, power, "Washer state update");
if power < self.threshold && self.running >= HYSTERESIS { if power < self.threshold && self.running >= HYSTERESIS {
// The washer is done running // The washer is done running