From 9b77c7854e9b464147b15b0c48290fbf7ff3f97d Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Mon, 15 Jan 2024 13:19:53 +1100 Subject: [PATCH] charge cable loggen --- src/api_interface.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/api_interface.rs b/src/api_interface.rs index fd0504f..d63100f 100644 --- a/src/api_interface.rs +++ b/src/api_interface.rs @@ -74,6 +74,7 @@ pub struct TeslaInterface { last_refresh: Instant, auth_path: PathBuf, metrics: Metrics, + last_conn_charge_cable: String, last_cop_state: String, last_climate_keeper: String, last_hvac_auto: String, @@ -120,6 +121,7 @@ impl TeslaInterface { auth_path, vehicle, metrics, + last_conn_charge_cable: String::new(), last_cop_state: String::new(), last_climate_keeper: String::new(), last_hvac_auto: String::new(), @@ -258,7 +260,13 @@ impl TeslaInterface { }) .await? .charge_state - .map(|v| v.into()); + .map(|v| { + if self.last_conn_charge_cable != v.conn_charge_cable { + log::warn!("Current conn charge cable: \"{}\"", v.conn_charge_cable); + self.last_conn_charge_cable = v.conn_charge_cable.clone(); + } + v.into() + }); let location_data = self .api @@ -281,17 +289,17 @@ impl TeslaInterface { .and_then(|v| { if self.last_cop_state != v.cabin_overheat_protection { log::warn!( - "Current cabin overheat protection state: {}", + "Current cabin overheat protection state: \"{}\"", v.cabin_overheat_protection ); self.last_cop_state = v.cabin_overheat_protection.clone(); } if self.last_climate_keeper != v.climate_keeper_mode { - log::warn!("Current climate keeper mode: {}", v.climate_keeper_mode); + log::warn!("Current climate keeper mode: \"{}\"", v.climate_keeper_mode); self.last_climate_keeper = v.climate_keeper_mode.clone(); } if self.last_hvac_auto != v.hvac_auto_request { - log::warn!("HVAC auto request set to: {}", v.hvac_auto_request); + log::warn!("HVAC auto request set to: \"{}\"", v.hvac_auto_request); self.last_hvac_auto = v.hvac_auto_request.clone(); } v.try_into().ok()