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

Release files for librehardwaremonitor-api 1.12.0

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.0
File Size Uploaded
librehardwaremonitor_api-1.12.0.tar.gz 105.2 kB Details

Built distribution (wheel)

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

Total release size: 114.6 kB

Release files / librehardwaremonitor_api-1.12.0.tar.gz

Download URL librehardwaremonitor_api-1.12.0.tar.gz
Size 105.2 kB
Tags Source
SHA-256 checksum
How to use checksums
354cbba8c7a0031032eb110f7628b89af775d45568f8a8fe9a5e41da5506a93d
BLAKE2b-256 checksum
How to use checksums
1c340e82f1fee3ae6311a9c60813172909eacd2e4122235dbb773b70414efc36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL librehardwaremonitor_api-1.12.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1748c839c6c27b7d65421171acb863b70ee3cd36c0de93791b4a4d18cd219f4b
BLAKE2b-256 checksum
How to use checksums
b279ff436aa8f51054d564ea398177ecb86898365f7c76dd46f77714e2fe029c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.12.0 This release

2 release files

1.11.1

2 release files

1.11.0

2 release files

1.10.1

2 release files

1.10.0

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.4

2 release files

1.8.3

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

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