blob: 57021f1da67ecb4f5746793188b915a01c136f5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
from enum import Enum, auto
class BatteryPowerDirection(Enum):
DISCHARGING = auto()
CHARGING = auto()
DO_NOTHING = auto()
class ChargingEvent(Enum):
AC_CHARGING_UNAVAILABLE_BECAUSE_SOLAR = auto()
AC_NOT_CHARGING = auto()
AC_CHARGING_STARTED = auto()
AC_DISCONNECTED = auto()
AC_CURRENT_CHANGED = auto()
AC_MOSTLY_CHARGED = auto()
AC_CHARGING_FINISHED = auto()
UTIL_CHARGING_STARTED = auto()
UTIL_CHARGING_STOPPED = auto()
UTIL_CHARGING_STOPPED_SOLAR = auto()
class ACPresentEvent(Enum):
CONNECTED = auto()
DISCONNECTED = auto()
class ChargingState(Enum):
NOT_CHARGING = auto()
AC_BUT_SOLAR = auto()
AC_WAITING = auto()
AC_OK = auto()
AC_DONE = auto()
class CurrentChangeDirection(Enum):
UP = auto()
DOWN = auto()
class BatteryState(Enum):
NORMAL = auto()
LOW = auto()
CRITICAL = auto()
class ACMode(Enum):
GENERATOR = 'generator'
UTILITIES = 'utilities'
class OutputSourcePriority(Enum):
SolarUtilityBattery = 'SUB'
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}')
|