diff --git a/Cargo.lock b/Cargo.lock index da474f9..be8171f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2567,7 +2567,7 @@ dependencies = [ [[package]] name = "tesla-charge-controller" -version = "1.0.11" +version = "1.0.12" dependencies = [ "async-channel", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 2a8000c..d51620c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tesla-charge-controller" -version = "1.0.11" +version = "1.0.12" edition = "2021" license = "MITNFA" description = "Controls Tesla charge rate based on solar charge data" diff --git a/src/api_interface.rs b/src/api_interface.rs index 66cf2b1..c3696e5 100644 --- a/src/api_interface.rs +++ b/src/api_interface.rs @@ -39,6 +39,7 @@ struct Metrics { charging_state: ChargingStateGauges, cabin_overheat_protection: CabinOverheatProtectionGauges, hvac_auto: HvacAutoRequestGauges, + home: Gauge, } impl Metrics { @@ -85,6 +86,8 @@ impl Metrics { let cabin_overheat_protection = CabinOverheatProtectionGauges::new(); describe_gauge!("tesla_hvac_auto_request", "HVAC auto"); let hvac_auto = HvacAutoRequestGauges::new(); + describe_gauge!("tesla_home", "Is home"); + let home = gauge!("tesla_home"); Self { battery_level, @@ -105,6 +108,7 @@ impl Metrics { charging_state, cabin_overheat_protection, hvac_auto, + home, } } } @@ -417,6 +421,7 @@ impl TeslaInterface { state.charge_state = Some(new_charge_state); } if let Some(new_location_data) = new_state.location_data { + self.metrics.home.set(bf(new_location_data.home)); state.location_data = Some(new_location_data); } if let Some(new_climate_state) = new_state.climate_state {