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 two callable methods to fetch data from your Libre Hardware Monitor instance:

  • get_data: Returns a LibreHardwareMonitorData object containing all sensor data.
  • get_main_hardware_devices: Returns a list containing all names of main hardware devices.

LibreHardwareMonitorData has 1 property with the following structure:

LibreHardwareMonitorData(
    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_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.sensor_data)
    
    main_hardware_devices = await client.get_main_hardware_devices()
    print(main_hardware_devices)

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.1.1.tar.gz (4.5 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.1.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for librehardwaremonitor_api-1.1.1.tar.gz
Algorithm Hash digest
SHA256 4e4bb4e9f15eaac247e93bd46194d24b7ded8355b9c5a50a634d484561ad3b7b
MD5 2d74147bf4df33a9b6f8569bbdc417ec
BLAKE2b-256 0d06ef78558f944f7a6c6de698cd7538cf879a044b9a923d7a2e76f74e5030b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for librehardwaremonitor_api-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5661add43d4e0d1c3daf96d00940ab0b705dc9dd2594c470b2f12f8a7e4756c1
MD5 7eb4b85c1ea62dcdbdc5ff4fafa6ff43
BLAKE2b-256 b17100d6ee35beb7eeb09cc7a9edec3b435786bfd5e6bb606b2eceeb53a2fb1a

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