Skip to main content

LibreHardwareMonitor API Client

A Python library for interacting with the LibreHardwareMonitor API.

Overview

This library provides a simple interface for fetching data from the API provided by the inbuilt LibreHardwareMonitor web server.

Installation

To install the library, run the following command:

pip install librehardwaremonitor-api

Usage

The LibreHardwareMonitorClient takes the following parameters:

  • Required:
    • host (str): hostname or IP address of your system
    • port (int): port used by Libre Hardware Monitor (default: 8085)
  • Optional:
    • username (str): if you have set up authentication for the webserver in Libre Hardware Monitor
    • password (str): if you have set up authentication for the webserver in Libre Hardware Monitor
    • session (aiohttp.ClientSession): provide a aiohttp.ClientSession

The library provides one callable method:

  • get_data: Returns a LibreHardwareMonitorData object containing the computer name, main hardware device names and all sensor data from your Libre Hardware Monitor instance.

LibreHardwareMonitorData has 4 properties with the following structure:

LibreHardwareMonitorData(
    computer_name: str
    # for example: "MY_COMPUTER"

    main_device_ids_and_names: dict[DeviceId, DeviceName]
    # for example:
    # {
    #     "amdcpu-0": "AMD Ryzen 7 7800X3D",
    #     "gpu-nvidia-0": "NVIDIA GeForce RTX 4080 SUPER"
    # }
    # the dictionary keys represent a unique device id.

    sensor_data: dict[str, LibreHardwareMonitorSensorData]
    # for example
    # {
    #     "amdcpu-0-power-0": {
    #         "name": Package Power",
    #         "value": "25.6",
    #         "type": "Power",
    #         "min": "25.2",
    #         "max": "76.4",
    #         "unit": "W",
    #         "device_id": "amdcpu-0",
    #         "device_name": "AMD Ryzen 7 7800X3D",
    #         "device_type": "CPU",
    #         "sensor_id": "amdcpu-0-power-0"
    #     },
    #     "amdcpu-0-power-1" : { ... },
    #     ...
    # }
    # the dictionary keys represent a unique sensor id.
    
    is_deprecated_version: bool
    # indicates whether the requested API version is deprecated
    # at the moment, versions <= 0.9.4 are deprecated
)

Example

import asyncio
from librehardwaremonitor_api import LibreHardwareMonitorClient

async def main():
    client = LibreHardwareMonitorClient("192.168.1.100", 8085)

    lhm_data = await client.get_data()
    print(lhm_data.computer_name)
    print(lhm_data.main_device_ids_and_names)
    print(lhm_data.sensor_data)
    
    if lhm_data.is_deprecated_version:
        print("Deprecated version detected.")

asyncio.run(main())

Development

This package uses uv as project manager.
To set up a dev environment, clone the project and run

uv sync

inside the project's root directory.
Set up pre-commit hooks with:

uv run pre-commit install

Optionally, execute manually via:

uv run pre-commit run --all-files

To run the unit tests, use:

uv run pytest

The parser is tested against snapshots of the parsed fixtures in tests/. After an intended change of the parsed data, review and update the snapshots via:

uv run pytest --snapshot-update

Metadata

Release files for librehardwaremonitor-api 1.12.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for librehardwaremonitor-api 1.12.1
File Size Uploaded Provenance Actions
librehardwaremonitor_api-1.12.1.tar.gz 105.7 kB Without provenance Details for librehardwaremonitor_api-1.12.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for librehardwaremonitor-api 1.12.1
File Interpreter ABI Platform Actions
librehardwaremonitor_api-1.12.1-py3-none-any.whl Python 3 none any Details for librehardwaremonitor_api-1.12.1-py3-none-any.whl

Total release size: 115.2 kB

Release files / librehardwaremonitor_api-1.12.1.tar.gz

Download URL librehardwaremonitor_api-1.12.1.tar.gz
Size 105.7 kB
Tags Source
SHA-256 checksum
How to use checksums
32cb9624ed700db28e19d9e48df29e69e7fdd4eda0061c85325b08f738d8d9fb
BLAKE2b-256 checksum
How to use checksums
9495b7c9feb8db81c77795211a6b365f1e93655544a926276401efb6b6701615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / librehardwaremonitor_api-1.12.1-py3-none-any.whl

Download URL librehardwaremonitor_api-1.12.1-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35a699b6153d5f251f29c204486ba42dd69be9e4d516a4c1450aab6690313bee
BLAKE2b-256 checksum
How to use checksums
fc08b98a0e3bb5547f47686043b70831a6945075402193cf56c92b783ae715ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for librehardwaremonitor-api 1.12.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page