diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-10-29 15:42:09 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-10-29 15:42:09 +0300 |
commit | 0fce6c52516aba239acc81fd528dcb5051c04f68 (patch) | |
tree | 2230dfe1d3102cc28537d6e566952dd6ae1a1e44 /src/home/inverter/types.py | |
parent | dbc33cf2293238534fd4d268e6a6d9405daae758 (diff) |
inverter_bot: add current OSP to status output
Diffstat (limited to 'src/home/inverter/types.py')
-rw-r--r-- | src/home/inverter/types.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/home/inverter/types.py b/src/home/inverter/types.py index 0292c15..57021f1 100644 --- a/src/home/inverter/types.py +++ b/src/home/inverter/types.py @@ -52,4 +52,13 @@ class ACMode(Enum): class OutputSourcePriority(Enum): SolarUtilityBattery = 'SUB' - SolarBatteryUtility = 'SBU'
\ No newline at end of file + SolarBatteryUtility = 'SBU' + + @classmethod + def from_text(cls, s: str): + if s == 'Solar-Battery-Utility': + return cls.SolarBatteryUtility + elif s == 'Solar-Utility-Battery': + return cls.SolarUtilityBattery + else: + raise ValueError(f'unknown value: {s}')
\ No newline at end of file |