Package oshi.hardware

Interface Sensors

All Known Implementing Classes:
AbstractSensors

@ThreadSafe public interface Sensors
Sensors include hardware sensors to monitor temperature, fan speed, and other information.

Drivers may or may not exist to collect this data depending on the installed hardware and Operating System. In addition, software-hardware communication may suffer intermittent errors when attempting to access this information. Users should expect, test for, and handle zero values and/or empty arrays which will result if the OS is unable to provide the information.

Windows information is generally retrieved via Windows Management Instrumentation (WMI). Unfortunately, most hardware providers do not publish sensor values to WMI. OSHI attempts to retrieve values from LibreHardwareMonitor if the optional jLibreHardwareMonitor dependency is included. Otherwise, OSHI attempts to retrieve values from Open Hardware Monitor if it is running. Otherwise, OSHI retrieves via the Microsoft API, which may require elevated permissions and still may provide no results or unchanging results depending on the motherboard manufacturer.

  • Method Details

    • getCpuTemperature

      double getCpuTemperature()
      CPU Temperature
      Returns:
      CPU Temperature in degrees Celsius if available, 0 or Double.NaN otherwise.

      See notes on Sensors.

    • getFanSpeeds

      int[] getFanSpeeds()
      Fan speeds
      Returns:
      Speed in rpm for all fans. May return empty array if no fans detected or 0 fan speed if unable to measure fan speed.
    • getCpuVoltage

      double getCpuVoltage()
      CPU Voltage
      Returns:
      CPU Voltage in Volts if available, 0 otherwise.