foxess/models/fox_settings/
id.rs1use core::str::FromStr;
8
9macro_rules! define_fox_settings {
21 (
22 $(
23 [$variant:ident, $key:literal, $doc:literal]
24 ),+ $(,)?
25 ) => {
26 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
30 #[non_exhaustive]
31 pub enum FoxSettings {
32 $(
33 #[doc = $doc]
34 $variant,
35 )+
36 }
37
38 impl FoxSettings {
39 #[inline]
46 pub const fn as_str(&self) -> &'static str {
47 match self {
48 $(
49 Self::$variant => $key,
50 )+
51 }
52 }
53 }
54
55 impl FromStr for FoxSettings {
56 type Err = ();
57
58 #[inline]
59 fn from_str(s: &str) -> Result<Self, Self::Err> {
60 match s {
61 $(
62 $key => Ok(Self::$variant),
63 )+
64 _ => Err(()),
65 }
66 }
67 }
68 };
69}
70
71define_fox_settings! {
74 [ActivePowerLimit, "ActivePowerLimit", "The limit on the inverter’s active power output"],
75 [ECOMode, "ECOMode", "Enables or configures energy-saving mode, typically optimizing battery charge/discharge based on time-of-use or self-consumption strategy"],
76 [EpsOutPut, "EpsOutPut", "Controls whether the EPS (Emergency Power Supply) backup output is enabled during grid outages"],
77 [ExportLimit, "ExportLimit", "Enables or disables the inverter’s grid export power limiting function"],
78 [ExportLimitPower, "ExportLimitPower", "Defines the maximum allowed power (in watts or percent) that can be exported to the grid"],
79 [GridCode, "GridCode", "Selects the country- or utility-specific grid compliance standard the inverter must follow"],
80 [GroundProtection, "GroundProtection", "Enables ground fault detection and protection functionality"],
81 [MaxSetChargeCurrent, "MaxSetChargeCurrent", "The maximum allowed battery charging current set for the inverter"],
82 [MaxSetDischargeCurrent, "MaxSetDischargeCurrent", "The maximum allowed battery discharging current set for the inverter"],
83 [MaxSoc, "MaxSoc", "The maximum battery state of charge (SOC) the system will charge up to"],
84 [Meter1Enable, "Meter1Enable", "Enables communication with and use of the primary external energy meter"],
85 [Meter2Enable, "Meter2Enable", "Enables communication with and use of a secondary external energy meter"],
86 [MinSoc, "MinSoc", "The minimum battery state of charge (SOC) allowed during normal operation"],
87 [MinSocOnGrid, "MinSocOnGrid", "The minimum battery state of charge (SOC) maintained while the grid is available"],
88 [SysSwitch, "SysSwitch", "Master system enable/disable switch for inverter operation"],
89 [WorkMode, "WorkMode", "Defines the inverter’s operating mode (e.g., self-consumption, feed-in priority, backup, or time-of-use mode)"],
90}