Skip to main content

Async Python client for the MiSTer FPGA mrext Remote API (REST + WebSocket) and SSH telemetry

Project description

python-mister-fpga

python-mister-fpga

Tests PyPI version Python versions License: MIT Docs

Async Python client for the mrext Remote API (REST + WebSocket) and optional SSH telemetry for the MiSTer FPGA. Zero Home Assistant dependency — use it in any Python project.

Install

pip install python-mister-fpga

Usage

REST client

import asyncio
from mister_fpga import MisterClient

async def main():
    client = MisterClient("192.168.1.50")
    status = await client.async_get_status()
    print(status.core, status.game)
    await client.async_launch_game("/media/fat/games/SNES/Chrono.sfc")
    await client.async_close()

asyncio.run(main())

WebSocket (real-time updates)

import asyncio
from mister_fpga import MisterWebSocketClient, MisterStatus, apply_ws_message

state = MisterStatus(online=True)
menu_path = None
index_state = (False, False)

def on_message(text: str) -> None:
    global state, menu_path, index_state
    state, menu_path, index_state = apply_ws_message(text, state, menu_path, index_state)
    print(state.core, state.game)

async def main():
    ws = MisterWebSocketClient("192.168.1.50")
    await ws.listen(on_message)

asyncio.run(main())

SSH telemetry

import asyncio
from mister_fpga import MisterSSH

async def main():
    ssh = MisterSSH("192.168.1.50", 22, "root", "1")
    data = await ssh.async_probe()
    print(data)
    await ssh.async_close()

asyncio.run(main())

API

  • MisterClient(host, port=8182, *, session=None, timeout=10) — async REST client; call await client.async_close() when done, or inject your own aiohttp.ClientSession.
  • MisterStatus — dataclass snapshot: online, core, system, game, hostname, version, ip, ips, dns, disk_total/used/free. Property is_running_game.
  • MisterConnectionError — raised on network/HTTP errors.
  • MisterWebSocketClient(host, port=8182, *, session=None, reconnect_delay=5) — reconnecting WS loop; await ws.listen(callback), call ws.stop() to exit.
  • apply_ws_message(message, status, menu_path, index_state) — pure reducer; apply a single WS text frame and return updated (status, menu_path, index_state).
  • MisterSSH(host, port, username, password) — persistent asyncssh connection; await ssh.async_probe() returns telemetry dict.
  • parse_ssh_probe(raw) — parse the raw batched SSH output into a telemetry dict.
  • KEYBOARD_NAMES, INI_VIDEO_KEYS, WS_PATH, DEFAULT_PORT — protocol constants.

Documentation

Full documentation is available at https://hudsonbrendon.github.io/python-mister-fpga/ — usage guide, runnable examples, and auto-generated API reference.

Credits

REST/WebSocket API by wizzomafizzo/mrext. MiSTer-kun logo by the MiSTer-devel project. Author @hudsonbrendon.

License

MIT — see LICENSE.

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

python_mister_fpga-0.1.2.tar.gz (176.3 kB view details)

Uploaded Source

Built Distribution

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

python_mister_fpga-0.1.2-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file python_mister_fpga-0.1.2.tar.gz.

File metadata

  • Download URL: python_mister_fpga-0.1.2.tar.gz
  • Upload date:
  • Size: 176.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python_mister_fpga-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3e41c65017adc7063ce9d25552504e4143594dfa61f9a3cad98d880175ec7318
MD5 489182ec1ebcd19f3a3929f079da6e82
BLAKE2b-256 71a563cff2b1c46fe6e25cc7c9c1b9e59d251d72d88ca0344b68fafb17693ad1

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_mister_fpga-0.1.2.tar.gz:

Publisher: release.yml on hudsonbrendon/python-mister-fpga

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_mister_fpga-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_mister_fpga-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e362f570aab3b610a4d62b9015dcfd82d0669c65b8bdcb65412aa3b902f44a49
MD5 29697bf836985508610d89df4654c66e
BLAKE2b-256 dd66ff4512baf09d6d66c403b950d9c7fe631760f51182a60db29749f720fc8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_mister_fpga-0.1.2-py3-none-any.whl:

Publisher: release.yml on hudsonbrendon/python-mister-fpga

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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