🌡️ Thermal and cooling API¶
linuxpy.thermal
¶
Human friendly interface to linux thermal subsystem.
The heart of linuxpy thermal library are the ThermalZone
and CoolingDevice
classes.
Probably the most common way to create a thermal device is through
the find
helper:
with find(type="x86_pkg_temp") as tz:
print(f"X86 temperature: {tz.temperature/1000:6.2f} C")
ThermalZone(syspath: os.PathLike)
¶
Bases: Device
Thermal sensor
ATTRIBUTE | DESCRIPTION |
---|---|
type |
thermal zone type
TYPE:
|
policy |
the policy
TYPE:
|
available_policies |
list of available policies
TYPE:
|
temperature |
current temperature in milli-celsius
TYPE:
|
offset |
offet in milli-celsius
TYPE:
|
mode |
current mode (enabled/disabled)
TYPE:
|
device_number |
thermal device number
TYPE:
|
trip_points |
list of trip points (new list every time)
TYPE:
|
TripPoint(temperature_path, type_path)
¶
Trip point associated with the thermal zone
ATTRIBUTE | DESCRIPTION |
---|---|
temperature |
trip point temperature in milli-celsius
TYPE:
|
type |
trip point type
TYPE:
|
CoolingDevice(syspath: os.PathLike)
¶
Bases: Device
Cooling device (fan, processor, ...)
ATTRIBUTE | DESCRIPTION |
---|---|
type |
thermal zone type
TYPE:
|
iter_thermal_zone_paths() -> Iterable[pathlib.Path]
¶
Returns an iterator over all thermal zone paths
iter_thermal_zone_devices() -> Iterable[ThermalZone]
¶
Returns an iterator over all thermal zone devices
iter_cooling_device_paths() -> Iterable[pathlib.Path]
¶
Returns an iterator over all cooling device paths
iter_cooling_devices() -> Iterable[CoolingDevice]
¶
Returns an iterator over all cooling devices
iter_devices() -> Iterable[Union[ThermalZone, CoolingDevice]]
¶
Returns an iterator over all thermal and cooling devices
find(find_all: bool = False, custom_match: Optional[Callable] = None, **kwargs) -> Union[Device, Iterable[Device], None]
¶
If find_all is False:
Find a device follwing the criteria matched by custom_match and kwargs. If no device is found matching the criteria it returns None. Default is to return a random first device.
If find_all is True:
The result is an iterator. Find all devices that match the criteria custom_match and kwargs. If no device is found matching the criteria it returns an empty iterator. Default is to return an iterator over all input devices found on the system.