From 636c5fc4821286555cdab311dd520cd0d08965ce Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Tue, 16 Jan 2024 10:59:31 +1100 Subject: [PATCH] charging state as enum --- src/vehicles.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/vehicles.rs b/src/vehicles.rs index fff57fb..a4948ee 100644 --- a/src/vehicles.rs +++ b/src/vehicles.rs @@ -218,7 +218,7 @@ pub struct ChargeState { pub charger_pilot_current: Option, pub charger_power: Option, pub charger_voltage: Option, - pub charging_state: String, + pub charging_state: ChargingState, pub conn_charge_cable: String, pub est_battery_range: f64, pub fast_charger_brand: String, @@ -251,6 +251,15 @@ pub struct ChargeState { pub user_charge_enable_request: Option, } +#[derive(Debug, Clone, Copy, Display, Deserialize, Serialize, PartialEq)] +pub enum ChargingState { + Charging, + Stopped, + Disconnected, + #[serde(other)] + Other, +} + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ClimateState { pub allow_cabin_overheat_protection: bool,