Library to control PiKVM with Python
Project description
PiKVM-Lib: A Python library for controlling/automating PiKVM Devices
PiKVM-Lib is a Python library that provides a simple and intuitive API for controlling PiKVM devices. With PiKVM-Lib, you can easily perform various actions on your PiKVM devices, such as:
- Getting system information
- Controlling ATX power
- Managing Mass Storage Device (MSD) images
- Interacting with General-Purpose Input/Output (GPIO) channels
- Taking snapshots and receive image
- Reading snapshots with OCR and receive text representation
- Send keys to the server
With PiKVM-Lib, you can automate tasks, integrate PiKVMs into your existing applications, and extend the capabilities of your PiKVM devices.
Installation
To install PiKVM, simply run the following command in your terminal:
pip install pikvm-lib
PiKVM device control
After installing PiKVM, you can import it into your Python script and create an instance of the PiKVM class. The PiKVM class constructor takes the following parameters:
hostname: The hostname or IP address of the PiKVM deviceusername: The username for authenticationpassword: The password for authentication
from pikvm_lib import PiKVM
pikvm_instance = PiKVM(hostname="192.168.1.10", username="admin", password="password")
Once you have created an instance of the PiKVM class, you can use it to interact with your PiKVM device.
For example, you can get the system information of the device:
system_info = pikvm_instance.get_system_info()
print(system_info)
You can also control the ATX power of the device:
pikvm_instance.set_atx_power(action="on")
For more information on how to use PiKVM, please refer to the official documentation: PiKVM official web and PiKVM API Reference
Usage examples
Here are some examples of how to use PiKVM to perform common tasks:
- Getting system information:
from pikvm_lib import PiKVM
pikvm_instance = PiKVM(hostname="192.168.1.10", username="admin", password="password")
system_info = pikvm_instance.get_system_info()
print(system_info)
- Turning on the ATX power:
pikvm_instance.set_atx_power(action="on")
- Uploading an MSD image:
pikvm_instance.upload_msd_image(filepath="/path/to/image.iso")
- Connecting the MSD:
pikvm_instance.connect_msd()
- Switching a GPIO channel:
pikvm_instance.switch_gpio_channel(channel=1, state=1)
- Take snapshot and receive OCR text:
pikvm_instance.get_streamer_snapshot(snapshot_path="/home/user/pikvm-snapshots",
filename="test.txt", ocr=True)
- Take snapshot and receive PIL image:
pikvm_instance.get_streamer_image()
- Send Key Press:
pikvm_instance.press('a')
- Send Hot Key:
pikvm_instance.hotkey('ctrl', 'alt', 'delete')
- Move Mouse to Location (x,y):
pikvm_instance.send_mouse_move_event(128, 256)
- Click Mouse at Location:
pikvm_instance.send_click("left")
- Drag mouse to Location (x,y):
pikvm_instance.send_mouse_event(button, "true")
pikvm_instance.send_mouse_move_event(128, 256)
pikvm_instance.send_mouse_event(button, "false")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pikvm_lib-0.5.0.tar.gz.
File metadata
- Download URL: pikvm_lib-0.5.0.tar.gz
- Upload date:
- Size: 34.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
822a504f1479da7da5b21cab2e10ee18f210a6df410ac5deb4959e9f9cd78b1b
|
|
| MD5 |
ce8758b72525c40cd20c50a4a5edb533
|
|
| BLAKE2b-256 |
48dfd675f079351c28da31bc7860ba3f6ae3de0d4fc0f5ae4dad9c611b58dc84
|
Provenance
The following attestation bundles were made for pikvm_lib-0.5.0.tar.gz:
Publisher:
publish.yml on guanana/pikvm-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pikvm_lib-0.5.0.tar.gz -
Subject digest:
822a504f1479da7da5b21cab2e10ee18f210a6df410ac5deb4959e9f9cd78b1b - Sigstore transparency entry: 586254909
- Sigstore integration time:
-
Permalink:
guanana/pikvm-lib@35b3c08805127a05cfb07239592481175e0e7373 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/guanana
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@35b3c08805127a05cfb07239592481175e0e7373 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pikvm_lib-0.5.0-py3-none-any.whl.
File metadata
- Download URL: pikvm_lib-0.5.0-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddcf0c3436d3773cb41aa14c328f2932a6e50d32cfcd219dfc56fae6a24d4b1c
|
|
| MD5 |
053aa7653c5c8196bbc8d70e19932fb2
|
|
| BLAKE2b-256 |
5753455c55d7aca4ccea38cd73fc7c24b964b483bdde94b1d704a4c897da77e2
|
Provenance
The following attestation bundles were made for pikvm_lib-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on guanana/pikvm-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pikvm_lib-0.5.0-py3-none-any.whl -
Subject digest:
ddcf0c3436d3773cb41aa14c328f2932a6e50d32cfcd219dfc56fae6a24d4b1c - Sigstore transparency entry: 586254915
- Sigstore integration time:
-
Permalink:
guanana/pikvm-lib@35b3c08805127a05cfb07239592481175e0e7373 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/guanana
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@35b3c08805127a05cfb07239592481175e0e7373 -
Trigger Event:
push
-
Statement type: