8. API - Hardware Monitor
8.1. Regular Classes
The following classes are intended for general use with the devices they represent. All classes in this section are concrete (not abstract).
8.1.1. HWM
- class lannerpsp.HWM(check_platform: bool = False)[source]
Hardware Monitor.
- Parameters:
check_platform (bool) – Set to
True
to check if the platform supports this feature. Defaults toFalse
for better compatibility.- Raises:
PSPNotSupport – This function is not supported (when
check_platform
is set toTrue
).NotImplementedError – It has not been verified to run on this platform (when
check_platform
is set toTrue
).
- get_cpu_temp(num: int) int [source]
Read temperature of the CPU processor (°C).
Example:
>>> hwm = HWM() >>> hwm.get_cpu_temp(1) 40
- Parameters:
num (int) – selects CPU number
- Returns:
the current temperature value of the CPU
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_sys_temp(num: int) int [source]
Read temperature of the system (°C).
Example:
>>> hwm = HWM() >>> hwm.get_sys_temp(1) 41
- Parameters:
num (int) – selects System sensor number
- Returns:
the current temperature value of the system
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_core_volt(num: int) float [source]
Read the CPU Vcore voltage (V).
Example:
>>> hwm = HWM() >>> hwm.get_core_volt(1) 0.856
- Parameters:
num (int) – selects CPU number
- Returns:
the current voltage of CPU Vcore
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_12v_volt() float [source]
Read the positive 12V voltage (V).
Example:
>>> hwm = HWM() >>> hwm.get_12v_volt() 12.232
- Returns:
the current voltage of positive 12V
- Return type:
- Raises:
PSPNotOpened – The library is not ready or opened yet.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_5v_volt() float [source]
Read the positive 5V voltage (V).
Example:
>>> hwm = HWM() >>> hwm.get_5v_volt() 5.087
- Returns:
the current voltage of positive 5V
- Return type:
- Raises:
PSPNotOpened – The library is not ready or opened yet.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_3v3_volt() float [source]
Read the positive 3.3V voltage (V).
Example:
>>> hwm = HWM() >>> hwm.get_3v3_volt() 3.328
- Returns:
the current voltage of positive 3.3V
- Return type:
- Raises:
PSPNotOpened – The library is not ready or opened yet.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_5vsb_volt() float [source]
Read the positive 5V standby power (V).
Example:
>>> hwm = HWM() >>> hwm.get_5vsb_volt() 5.003
- Returns:
the current voltage of positive 5V standby power
- Return type:
- Raises:
PSPNotOpened – The library is not ready or opened yet.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_3v3sb_volt() float [source]
Read the positive 3V/3.3V standby power (V).
Example:
>>> hwm = HWM() >>> hwm.get_3v3sb_volt() 3.344
- Returns:
the current voltage of positive 3.3V standby power
- Return type:
- Raises:
PSPNotOpened – The library is not ready or opened yet.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_bat_volt() float [source]
Read the battery voltage (V).
Example:
>>> hwm = HWM() >>> hwm.get_bat_volt() 3.168
- Returns:
the current voltage of the battery
- Return type:
- Raises:
PSPNotOpened – The library is not ready or opened yet.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_dimm_volt(ch: int) float [source]
Read the DRAM voltage (V).
Example:
>>> hwm = HWM() >>> hwm.get_dimm_volt() 1.096
- Parameters:
ch (int) – the DDR channel
- Returns:
the current voltage of the DDR channel
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_psu_volt(num: int) int [source]
Read the power supply AC input (V).
- Parameters:
num (int) – the AC power supply number which is described in user manual
- Returns:
the AC power voltage
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_cpu_fan_speed(num: int) int [source]
Get CPU fan speed (RPM).
- Parameters:
num (int) – the number of fan
- Returns:
the fan speed
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_sys_fan_speed(num: int) int [source]
Get SYS fan speed (RPM).
- Parameters:
num (int) – the number of fan
- Returns:
the fan speed
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_fan_speed(num: int) int [source]
Read the fan speed which was assigned (RPM).
Example:
>>> hwm = HWM() >>> hwm.get_fan_speed(1) 7297
- Parameters:
num (int) – the fan index number which is described in user manual
- Returns:
the fan speed
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_fan_speed_ex(num: int, ex_num: int) int [source]
Read the fan speed which was assigned (RPM).
Example:
>>> hwm = HWM() >>> hwm.get_fan_speed_ex(1, 1) 7258
- Parameters:
- Returns:
the fan speed
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_sensor_name(sid: int) str [source]
Get the sensor ID name by PSP define.
Example:
>>> hwm = HWM() >>> hwm.get_sensor_name(0) 'HWMID_TEMP_CPU1'
- Parameters:
sid (int) – sensor index number
- Returns:
the sensor name of the designated
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- get_sensor_msg(sid: int) str [source]
Read the sensor report message.
Example:
>>> hwm = HWM() >>> hwm.get_sensor_msg(0) '41000 mCelsius'
- Parameters:
sid (int) – sensor index number
- Returns:
the message of the designated
- Return type:
- Raises:
TypeError – The input parameters type error.
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
- list_supported_sensors() List[HWMSensorModel] [source]
List all supported sensors.
Example:
>>> hwm = HWM() >>> sensors = hwm.list_supported_sensors() >>> for s in sensors: ... s.to_dict() {'sid': 0, 'name': 'HWMID_TEMP_CPU1', 'display_name': 'CPU 1 temperature', 'value': 40, 'unit': 'C'} {'sid': 2, 'name': 'HWMID_TEMP_SYS1', 'display_name': 'SYS 1 temperature', 'value': 42, 'unit': 'C'} . . . {'sid': 12, 'name': 'HWMID_VOLT_DDRCH1', 'display_name': 'DDR channel 1', 'value': 1.096, 'unit': 'V'} >>> for s in sensors: ... print(f"{s.display_name} = {s.value} {s.unit}") ... CPU-1 temperature = 40 C SYS-1 temperature = 42 C . . . VDIMM-1 = 1.096 V
- Returns:
list of supported sensor model
- Return type:
List[HWMSensorModel]
- Raises:
PSPNotOpened – The library is not ready or opened yet.
PSPInvalid – The input parameter is out of range.
PSPNotSupport – This platform does not support this function.
PSPError – General PSP functional error.
8.2. Models
The following models are used to store data for data modeling.
8.2.1. HWMSensorModel
8.3. Supported Platforms
Note
Almost for all versions of Lanner PSP on all platforms.
The following platforms have been verified and confirmed to be supported: