LiquidGUI [1.1.0.0] DEV
- Moved device init into dedicated function to prevent unwanted device re-init. - Library renaming.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
from liquidctl import find_liquidctl_devices, cli
|
||||
|
||||
class LiquidCTL_Helper():
|
||||
device_name = None
|
||||
device_temp = 0
|
||||
device_fanSpeed = 0
|
||||
device_pumpSpeed = 0
|
||||
device_fwVers = None
|
||||
|
||||
devices = find_liquidctl_devices()
|
||||
for dev in devices:
|
||||
with dev.connect():
|
||||
#print(f'{dev.description}')
|
||||
device_name = dev.description
|
||||
device_fwVers = ''.join(map(str, dev.firmware_version))
|
||||
|
||||
def ForceInit(self):
|
||||
init_status = self.dev.initialize()
|
||||
if init_status:
|
||||
for key, value, unit in init_status:
|
||||
#print(f'- {key}: {value} {unit}')
|
||||
device_fwVers = value
|
||||
|
||||
def TestConnectionState(self):
|
||||
if self.device_name != None:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def Update(self):
|
||||
with self.dev.connect():
|
||||
status = self.dev.get_status()
|
||||
for key, value, unit in status:
|
||||
#print(f'- {key}: {value} {unit}')
|
||||
if key == "Liquid temperature":
|
||||
self.device_temp = value
|
||||
elif key == "Fan speed":
|
||||
self.device_fanSpeed = value
|
||||
elif key == "Pump speed":
|
||||
self.device_pumpSpeed = value
|
||||
|
||||
def SetFanSpeed(self, speed):
|
||||
with self.dev.connect():
|
||||
cli._device_set_speed(self.dev, args={"<temperature>": [],
|
||||
"<channel>": "fan",
|
||||
"<percentage>": [str(speed)]})
|
||||
Reference in New Issue
Block a user