From d1a5666d18f9c14a76100e58469fc29489e4414f Mon Sep 17 00:00:00 2001 From: Maxime Augier Date: Mon, 26 Aug 2024 22:21:28 +0200 Subject: [PATCH] Add a few observables --- src/observation.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/observation.rs b/src/observation.rs index 8427198..849dab5 100644 --- a/src/observation.rs +++ b/src/observation.rs @@ -171,7 +171,7 @@ pub enum Observation { SelfTestDetails(String), WifiEvent(i64), ChargerOfflineReason(i64), - CircuitMaxCurrent { phase: u8, amperes: i64 }, + CircuitMaxCurrent { phase: u8, amperes: f64 }, SiteID(String), IsEnabled(bool), Temperature(i64), @@ -183,10 +183,17 @@ pub enum Observation { MobileNetworkOperator(String), ReasonForNoCurrent(ReasonForNoCurrent), + + LocalPreauthEnabled(bool), + LocalOfflineAuthEnabled(bool), + AllowOfflineTxUnknownId(bool), + PilotMode(PilotMode), SmartCharging(bool), CableLocked(bool), CableRating(f64), + + UserId(String), ChargerOpMode(ChargerOpMode), IntCurrent { pin: InputPin, current: f64 }, @@ -198,6 +205,8 @@ pub enum Observation { TotalPower(f64), EnergyPerHour(f64), LifetimeEnergy(f64), + LifetimeRelaySwitches(i64), + LifetimeHours(i64), Unknown { code: u16, value: ObservationData }, } @@ -229,9 +238,9 @@ impl Observation { (2, String(details)) => SelfTestDetails(details), (10, Integer(wifi)) => WifiEvent(wifi), (11, Integer(reason)) => ChargerOfflineReason(reason), - (22, Integer(amperes)) => CircuitMaxCurrent { phase: 1, amperes }, - (23, Integer(amperes)) => CircuitMaxCurrent { phase: 2, amperes }, - (24, Integer(amperes)) => CircuitMaxCurrent { phase: 3, amperes }, + (22, Double(amperes)) => CircuitMaxCurrent { phase: 1, amperes }, + (23, Double(amperes)) => CircuitMaxCurrent { phase: 2, amperes }, + (24, Double(amperes)) => CircuitMaxCurrent { phase: 3, amperes }, (26, String(site)) => SiteID(site), (31, Boolean(enabled)) => IsEnabled(enabled), (32, Integer(temperature)) => Temperature(temperature), @@ -252,6 +261,10 @@ impl Observation { (109, Integer(mode)) => ChargerOpMode(op_mode_from_int(mode)), (110, Integer(mode)) => ActiveOutputPhase(deserialize_i64(mode).unwrap_or(OutputPhase::Unknown)), (120, Double(power)) => TotalPower(power), + (122, Double(energy)) => EnergyPerHour(energy), + (124, Double(energy)) => LifetimeEnergy(energy), + (125, Integer(count)) => LifetimeRelaySwitches(count), + (126, Integer(hours)) => LifetimeHours(hours), (150, Integer(degrees)) => MaximumTemperature(degrees), (182, Double(current)) => IntCurrent { pin: T2, current }, (183, Double(current)) => IntCurrent { pin: T3, current },