From 778e92fa43321f95873fc3d5e5ed60b46bd9f24d Mon Sep 17 00:00:00 2001 From: Jeff Curless Date: Sun, 2 Nov 2025 17:35:34 -0500 Subject: [PATCH] Add support for add extra commands to smartctl Add extra commands on a drive by drive basis for smartctl --- monitor/oneUpMon.py | 3 ++- monitor/systemsupport.py | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/monitor/oneUpMon.py b/monitor/oneUpMon.py index 3f73428..676e003 100755 --- a/monitor/oneUpMon.py +++ b/monitor/oneUpMon.py @@ -358,7 +358,8 @@ class MonitorWindow(QMainWindow): try: for _drive in self.multiDrive.drives: if not _drive in self.driveTempFilter: - temperatures.append( self.multiDrive.driveTemp( _drive ) ) + extraCmd = self.config.getValue( 'smartctl', _drive, None ) + temperatures.append( self.multiDrive.driveTemp( _drive, extraCmd )) except Exception: temperatures = [ 0.0 for _ in self.multiDrive.drives ] diff --git a/monitor/systemsupport.py b/monitor/systemsupport.py index dbad19d..c0345e7 100755 --- a/monitor/systemsupport.py +++ b/monitor/systemsupport.py @@ -167,9 +167,13 @@ class multiDriveStat(): except: return 0 - def driveTemp(self,_drive) -> float: + def driveTemp(self,_drive:str, extracmd = None) -> float: smartOutRaw = "" - cmd = f'sudo smartctl -A /dev/{_drive}' + if extracmd is None: + cmd = f'sudo smartctl -A /dev/{_drive}' + else: + cmd = f'sudo smartctl {extracmd} -a /dev/{_drive}' + try: command = os.popen( cmd ) smartOutRaw = command.read() @@ -219,7 +223,7 @@ class multiDriveStat(): class CPUInfo: ''' - This class deals with getting data about a Raspberry PI CPU + This class deals with getting data about a Raspberry PI 5 CPU fan. ''' def __init__( self ):