Add support for add extra commands to smartctl

Add extra commands on a drive by drive basis for smartctl
This commit is contained in:
Jeff Curless
2025-11-02 17:35:34 -05:00
parent a1ac933238
commit 778e92fa43
2 changed files with 9 additions and 4 deletions

View File

@@ -358,7 +358,8 @@ class MonitorWindow(QMainWindow):
try: try:
for _drive in self.multiDrive.drives: for _drive in self.multiDrive.drives:
if not _drive in self.driveTempFilter: 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: except Exception:
temperatures = [ 0.0 for _ in self.multiDrive.drives ] temperatures = [ 0.0 for _ in self.multiDrive.drives ]

View File

@@ -167,9 +167,13 @@ class multiDriveStat():
except: except:
return 0 return 0
def driveTemp(self,_drive) -> float: def driveTemp(self,_drive:str, extracmd = None) -> float:
smartOutRaw = "" 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: try:
command = os.popen( cmd ) command = os.popen( cmd )
smartOutRaw = command.read() smartOutRaw = command.read()
@@ -219,7 +223,7 @@ class multiDriveStat():
class CPUInfo: 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 ): def __init__( self ):