jtjones1001 / nvmetools

Basic tools for working with NVMe SSD on Windows or Linux
MIT License
13 stars 2 forks source link

readnvme - KeyError: 'Thermal Management Temperature 1 Time' [Windows] #5

Open kiloforce opened 6 months ago

kiloforce commented 6 months ago

If Thermal temperature 1 isn't available script fails out with python error. Script should handle gracefully.

C:\> readnvme -n 2

 Epic! NVMe Tools, version 0.8.0, www.nvmetools.com, Copyright (C) 2023 Joe Jones
         ------------------------------------------------------------------------------------------
          NVME DRIVE 2  (\\.\PHYSICALDRIVE2)
         ------------------------------------------------------------------------------------------
...
...
         ----------------------------------------------------------------------
          Temperature       Value          Under Threshold     Over Threshold
         ----------------------------------------------------------------------
          Composite         43 C           -273 C              70 C
          Sensor 1          40 C           -273 C              65,262 C

         ------------------------------------------------------------------------
          Throttle      Total       TMT1        TMT2        WCTEMP      CCTEMP
         ------------------------------------------------------------------------
 ------------------------------------------------------------------------------------------
  FATAL ERROR : 50
 ------------------------------------------------------------------------------------------
 Unknown error.  Send developer details below and debug.log

Traceback (most recent call last):
  File "C:\Python312\Lib\site-packages\nvmetools\console\readnvme.py", line 201, in read_nvme
    info.show()
  File "C:\Python312\Lib\site-packages\nvmetools\support\info.py", line 657, in show
    self._show()
  File "C:\Python312\Lib\site-packages\nvmetools\support\info.py", line 443, in _show
    self.smart(as_list)
  File "C:\Python312\Lib\site-packages\nvmetools\support\info.py", line 666, in smart
    self.temperature(as_list=as_list)
  File "C:\Python312\Lib\site-packages\nvmetools\support\info.py", line 779, in temperature
    + f"{as_int(self.parameters['Thermal Management Temperature 1 Time'])/3600:<12,.3f}"
                ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'Thermal Management Temperature 1 Time'
C:\> readnvme -n 2 -a
...
          Composite Temperature                              43 C
          Composite Temperature Over Threshold               70 C
          Composite Temperature Under Threshold              -273 C
          Critical Composite Temperature Threshold (CCTEMP)  80 C
          Critical Composite Temperature Time                0 Min
          Host Controlled Thermal Management (HCTMA)         Not Supported
          Maximum Thermal Management Temperature (MXTMT)     Not Reported
          Minimum Thermal Management Temperature (MNTMT)     Not Reported
          Temperature Over/Under Threshold                   No
          Temperature Sensor 1                               40 C
          Temperature Sensor 1 Over Threshold                65,262 C
          Temperature Sensor 1 Under Threshold               -273 C
          Warning Composite Temperature Threshold (WCTEMP)   70 C
          Warning Composite Temperature Time                 0 Min
          Windows Power ASPM (AC)                            Attempt L0s
          Windows Power ASPM (DC)                            Attempt L1