File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
servercom/implementations Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ def basic_auth_str(user: str, pwd: str) -> str:
2525 HUMIDITY = "humidity" ,
2626 PRESSURE = "pressure" ,
2727 LIGHT_INTENSITY = "light intensity" ,
28- COMMENT = "comment"
28+ COMMENT = "comment" ,
29+ BATTERY = "remaining battery"
2930)
3031
3132class DataPoint ():
@@ -84,6 +85,12 @@ class Text(DataPoint):
8485 def __init__ (self , value : str ):
8586 super ().__init__ (DataClass .COMMENT , value )
8687
88+ class BatteryLevel (DataPoint ):
89+ """A class reserved for DataPoints that are intended as an indication of battery level"""
90+ UNIT = "%" # No unit for regular strings of text
91+ def __init__ (self , value : int ):
92+ super ().__init__ (DataClass .BATTERY , value )
93+
8794class ConnectionError (Exception ):
8895 """Indicates an issue with the server connection"""
8996
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ class DataClass(str, Enum):
2121 PRESSURE = "pressure"
2222 LIGHT_INTENSITY = "light intensity"
2323 COMMENT = "comment"
24+ BATTERY = "remaining battery"
2425
2526class DataPoint ():
2627 """A class for storing and handling datapoints"""
@@ -78,6 +79,12 @@ class Text(DataPoint):
7879 def __init__ (self , value : str ):
7980 super ().__init__ (DataClass .COMMENT , value )
8081
82+ class BatteryLevel (DataPoint ):
83+ """A class reserved for DataPoints that are intended as an indication of battery level"""
84+ UNIT = "%" # No unit for regular strings of text
85+ def __init__ (self , value : int ):
86+ super ().__init__ (DataClass .BATTERY , value )
87+
8188class ConnectionError (Exception ):
8289 """Indicates an issue with the server connection"""
8390
You can’t perform that action at this time.
0 commit comments