log whether is at home
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m51s

This commit is contained in:
Alex Janka 2024-01-21 09:48:54 +11:00
parent 99c5d23d35
commit 0a26850ce4
3 changed files with 7 additions and 2 deletions

2
Cargo.lock generated
View file

@ -2567,7 +2567,7 @@ dependencies = [
[[package]]
name = "tesla-charge-controller"
version = "1.0.11"
version = "1.0.12"
dependencies = [
"async-channel",
"chrono",

View file

@ -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"

View file

@ -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 {