Skip to main content

A Python API client for LibreHardwareMonitor

Project description

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.

Methods

The library provides one callable method:

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

LibreHardwareMonitorData has 3 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",
    #         "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.
)

Installation

To install the library, run the following command:

pip install librehardwaremonitor-api

Usage

import asyncio
from librehardwaremonitor_api import LibreHardwareMonitorClient

async def main():
    client = LibreHardwareMonitorClient("<HOSTNAME OR IP ADDRESS>", <PORT>)
    
    lhm_data = await client.get_data()
    print(lhm_data.main_device_ids_and_names)
    print(lhm_data.sensor_data)

asyncio.run(main())

TODO

  • implement basic auth

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

librehardwaremonitor_api-1.7.0.tar.gz (60.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

librehardwaremonitor_api-1.7.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file librehardwaremonitor_api-1.7.0.tar.gz.

File metadata

  • Download URL: librehardwaremonitor_api-1.7.0.tar.gz
  • Upload date:
  • Size: 60.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}

File hashes

Hashes for librehardwaremonitor_api-1.7.0.tar.gz
Algorithm Hash digest
SHA256 30e3ce6400a5b1694e09f1467eb651d99d16c62042964f2289c7979b4effa7f2
MD5 7ccbf0c65fa3a8dad06361aa323972cc
BLAKE2b-256 bc611e7d6c95164567922c4c57be4f1c99faaa20ff7b51a19867213f331c96b0

See more details on using hashes here.

File details

Details for the file librehardwaremonitor_api-1.7.0-py3-none-any.whl.

File metadata

  • Download URL: librehardwaremonitor_api-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}

File hashes

Hashes for librehardwaremonitor_api-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b8d047a471fa0351e3dc4378ac901fe1501c9bdade2c3bad4908ee09054b715
MD5 e3cf873f8e4e322d1f0a503e75625ac7
BLAKE2b-256 b1768315dabc328c6ed2eafbd49e7a8f55250bc511293ff504dba76f5f1ac23c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page