Skip to content

aiopikvm

Async Python client for the PiKVM API.

Key features

  • Full async/await API built on httpx
  • 9 API resources: ATX, HID, MSD, GPIO, Streamer, Switch, Redfish, Prometheus, Auth
  • WebSocket client for realtime events and low-latency HID input
  • Pydantic v2 response models with full type safety
  • PEP 561 compatible — works with mypy strict mode
  • TOTP two-factor authentication support

Quick example

import asyncio
from aiopikvm import PiKVM

async def main():
    async with PiKVM("https://pikvm.local", user="admin", passwd="admin") as kvm:
        # Check host power state
        state = await kvm.atx.get_state()
        if not state.leds.power:
            await kvm.atx.power_on()

        # Type text via HID
        await kvm.hid.type_text("Hello from aiopikvm!")

        # Take a screenshot
        snapshot = await kvm.streamer.snapshot()
        with open("screen.jpeg", "wb") as f:
            f.write(snapshot)

asyncio.run(main())

Getting started

New to aiopikvm? Start here:

User guide

Detailed guides for each API resource:

API reference

Auto-generated from source code docstrings: