From 8a9b2336308576c71b94e8f49594fd5d0a0ee02b Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Sun, 28 Jan 2024 16:21:14 +1100 Subject: [PATCH] "complete" charge state --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/api_interface.rs | 14 ++++++++++++++ vendored/teslatte | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb35c70..c246a85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2554,7 +2554,7 @@ dependencies = [ [[package]] name = "tesla-charge-controller" -version = "1.1.3" +version = "1.1.4" dependencies = [ "chrono", "clap 4.4.11", diff --git a/Cargo.toml b/Cargo.toml index 9677e59..1869101 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tesla-charge-controller" -version = "1.1.3" +version = "1.1.4" 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 45567e6..c7b4057 100644 --- a/src/api_interface.rs +++ b/src/api_interface.rs @@ -90,6 +90,7 @@ struct ChargingStateGauges { charging: GenericGauge, stopped: GenericGauge, disconnected: GenericGauge, + complete: GenericGauge, other: GenericGauge, } @@ -98,12 +99,14 @@ impl ChargingStateGauges { let charging = CHARGING_STATE.with_label_values(&["charging"]); let stopped = CHARGING_STATE.with_label_values(&["stopped"]); let disconnected = CHARGING_STATE.with_label_values(&["disconnected"]); + let complete = CHARGING_STATE.with_label_values(&["complete"]); let other = CHARGING_STATE.with_label_values(&["other"]); Self { charging, stopped, disconnected, + complete, other, } } @@ -114,26 +117,37 @@ impl ChargingStateGauges { self.charging.set(1); self.stopped.set(0); self.disconnected.set(0); + self.complete.set(0); self.other.set(0); } ChargingState::Stopped => { self.charging.set(0); self.stopped.set(1); self.disconnected.set(0); + self.complete.set(0); self.other.set(0); } ChargingState::Disconnected => { self.charging.set(0); self.stopped.set(0); self.disconnected.set(1); + self.complete.set(0); self.other.set(0); } ChargingState::Other => { self.charging.set(0); self.stopped.set(0); self.disconnected.set(0); + self.complete.set(0); self.other.set(1); } + ChargingState::Complete => { + self.charging.set(0); + self.stopped.set(0); + self.disconnected.set(0); + self.complete.set(1); + self.other.set(0); + } } } } diff --git a/vendored/teslatte b/vendored/teslatte index a350280..cf30a7d 160000 --- a/vendored/teslatte +++ b/vendored/teslatte @@ -1 +1 @@ -Subproject commit a350280662bfca096ea153903bdc3dcb2652f415 +Subproject commit cf30a7d1bc78c6f4817fcadf15c1d2b47dce5909