Add a few observables

This commit is contained in:
Maxime Augier 2024-08-26 22:21:28 +02:00
parent 4a4dea12ce
commit d1a5666d18

View File

@ -171,7 +171,7 @@ pub enum Observation {
SelfTestDetails(String), SelfTestDetails(String),
WifiEvent(i64), WifiEvent(i64),
ChargerOfflineReason(i64), ChargerOfflineReason(i64),
CircuitMaxCurrent { phase: u8, amperes: i64 }, CircuitMaxCurrent { phase: u8, amperes: f64 },
SiteID(String), SiteID(String),
IsEnabled(bool), IsEnabled(bool),
Temperature(i64), Temperature(i64),
@ -183,10 +183,17 @@ pub enum Observation {
MobileNetworkOperator(String), MobileNetworkOperator(String),
ReasonForNoCurrent(ReasonForNoCurrent), ReasonForNoCurrent(ReasonForNoCurrent),
LocalPreauthEnabled(bool),
LocalOfflineAuthEnabled(bool),
AllowOfflineTxUnknownId(bool),
PilotMode(PilotMode), PilotMode(PilotMode),
SmartCharging(bool), SmartCharging(bool),
CableLocked(bool), CableLocked(bool),
CableRating(f64), CableRating(f64),
UserId(String), UserId(String),
ChargerOpMode(ChargerOpMode), ChargerOpMode(ChargerOpMode),
IntCurrent { pin: InputPin, current: f64 }, IntCurrent { pin: InputPin, current: f64 },
@ -198,6 +205,8 @@ pub enum Observation {
TotalPower(f64), TotalPower(f64),
EnergyPerHour(f64), EnergyPerHour(f64),
LifetimeEnergy(f64), LifetimeEnergy(f64),
LifetimeRelaySwitches(i64),
LifetimeHours(i64),
Unknown { code: u16, value: ObservationData }, Unknown { code: u16, value: ObservationData },
} }
@ -229,9 +238,9 @@ impl Observation {
(2, String(details)) => SelfTestDetails(details), (2, String(details)) => SelfTestDetails(details),
(10, Integer(wifi)) => WifiEvent(wifi), (10, Integer(wifi)) => WifiEvent(wifi),
(11, Integer(reason)) => ChargerOfflineReason(reason), (11, Integer(reason)) => ChargerOfflineReason(reason),
(22, Integer(amperes)) => CircuitMaxCurrent { phase: 1, amperes }, (22, Double(amperes)) => CircuitMaxCurrent { phase: 1, amperes },
(23, Integer(amperes)) => CircuitMaxCurrent { phase: 2, amperes }, (23, Double(amperes)) => CircuitMaxCurrent { phase: 2, amperes },
(24, Integer(amperes)) => CircuitMaxCurrent { phase: 3, amperes }, (24, Double(amperes)) => CircuitMaxCurrent { phase: 3, amperes },
(26, String(site)) => SiteID(site), (26, String(site)) => SiteID(site),
(31, Boolean(enabled)) => IsEnabled(enabled), (31, Boolean(enabled)) => IsEnabled(enabled),
(32, Integer(temperature)) => Temperature(temperature), (32, Integer(temperature)) => Temperature(temperature),
@ -252,6 +261,10 @@ impl Observation {
(109, Integer(mode)) => ChargerOpMode(op_mode_from_int(mode)), (109, Integer(mode)) => ChargerOpMode(op_mode_from_int(mode)),
(110, Integer(mode)) => ActiveOutputPhase(deserialize_i64(mode).unwrap_or(OutputPhase::Unknown)), (110, Integer(mode)) => ActiveOutputPhase(deserialize_i64(mode).unwrap_or(OutputPhase::Unknown)),
(120, Double(power)) => TotalPower(power), (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), (150, Integer(degrees)) => MaximumTemperature(degrees),
(182, Double(current)) => IntCurrent { pin: T2, current }, (182, Double(current)) => IntCurrent { pin: T2, current },
(183, Double(current)) => IntCurrent { pin: T3, current }, (183, Double(current)) => IntCurrent { pin: T3, current },