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 2 properties with the following structure:

LibreHardwareMonitorData(
    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.3.0.tar.gz (4.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.3.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for librehardwaremonitor_api-1.3.0.tar.gz
Algorithm Hash digest
SHA256 209e7d9e89e082ad9ce000523df1e0fe7d7a0a9684b13d36e382f99fa1567f2b
MD5 7e991c2dc84cb92ad1bac70c74770e28
BLAKE2b-256 6c191c5daaa3903b1f1950b48aa43f2c24d7e41d78d7d8ddb5a65aba4bd6e13d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for librehardwaremonitor_api-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f1a3811a3daf17aecaf9e58b0ee0056ce3c28712e3eab37bf11e19278ad7673
MD5 4e06cd636b063be5adc08933cb1ba37f
BLAKE2b-256 9e3d80cb556c4503e534ba69db9830cc16f83a8afed623d9f9f8f5577e1f5a23

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