33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
import subprocess
|
|
import re
|
|
|
|
class LiquidCTL_Helper():
|
|
device_name = None
|
|
device_temp = 0
|
|
device_fanSpeed = 0
|
|
device_pumpSpeed = 0
|
|
device_fwVers = None
|
|
|
|
devices = None
|
|
|
|
def ForceInit(self):
|
|
NotImplemented
|
|
|
|
def TestConnectionState(self):
|
|
output = subprocess.run(["liquidctl", "status"], stdout=subprocess.PIPE, universal_newlines=True)
|
|
if len(output.stdout) > 0:
|
|
return False
|
|
else:
|
|
return True
|
|
|
|
def Update(self):
|
|
output = subprocess.run(["liquidctl", "status"], stdout=subprocess.PIPE, universal_newlines=True)
|
|
self.device_name = str(re.search(r'^[^\n]*', output.stdout).group(0))
|
|
self.device_temp = float(re.search(r'Liquid temperature\s+(\d+\.?\d*)', output.stdout).group(1))
|
|
self.device_fanSpeed = int(re.search(r'Fan speed\s+(\d+)', output.stdout).group(1))
|
|
self.device_pumpSpeed = int(re.search(r'Pump speed\s+(\d+)', output.stdout).group(1))
|
|
|
|
|
|
def SetFanSpeed(self, speed):
|
|
NotImplemented
|