From 79454ff95a0b2b308f5d2c859e40d30fda7856fb Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Tue, 16 Jan 2024 11:10:20 +1100 Subject: [PATCH] default state control enable --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/tesla_charge_rate.rs | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 892d340..c58b897 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2256,7 +2256,7 @@ dependencies = [ [[package]] name = "tesla-charge-controller" -version = "1.0.0-beta-1" +version = "1.0.0-beta-2" dependencies = [ "async-channel", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 87bb537..e40bc85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tesla-charge-controller" -version = "1.0.0-beta-1" +version = "1.0.0-beta-2" edition = "2021" license = "MITNFA" description = "Controls Tesla charge rate based on solar charge data" diff --git a/src/tesla_charge_rate.rs b/src/tesla_charge_rate.rs index 5012cf7..85099ec 100644 --- a/src/tesla_charge_rate.rs +++ b/src/tesla_charge_rate.rs @@ -23,11 +23,19 @@ pub enum TcrcRequest { EnableAutomaticControl, } -#[derive(Default, Clone, Copy, Serialize, Deserialize, Debug)] +#[derive(Clone, Copy, Serialize, Deserialize, Debug)] pub struct TcrcState { pub control_enable: bool, } +impl Default for TcrcState { + fn default() -> Self { + Self { + control_enable: true, + } + } +} + impl TeslaChargeRateController { pub fn new(car_state: Arc>, pl_state: Option>>) -> Self { describe_gauge!("tcrc_control_enable", "Enable Tesla charge rate control");