Async Python client for the MiSTer FPGA mrext Remote API (REST + WebSocket) and SSH telemetry
Project description
python-mister-fpga
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; callawait client.async_close()when done, or inject your ownaiohttp.ClientSession.MisterStatus— dataclass snapshot:online,core,system,game,hostname,version,ip,ips,dns,disk_total/used/free. Propertyis_running_game.MisterConnectionError— raised on network/HTTP errors.MisterWebSocketClient(host, port=8182, *, session=None, reconnect_delay=5)— reconnecting WS loop;await ws.listen(callback), callws.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.
Credits
REST/WebSocket API by wizzomafizzo/mrext. MiSTer-kun logo by the MiSTer-devel project. Author @hudsonbrendon.
License
MIT — see LICENSE.
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 python_mister_fpga-0.1.1.tar.gz.
File metadata
- Download URL: python_mister_fpga-0.1.1.tar.gz
- Upload date:
- Size: 92.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
035cd75c2e24af16a9b948b24527ecbedaed255cdf87ff78616de2af2894ffed
|
|
| MD5 |
d861fcb20de76728c503065debe9fa98
|
|
| BLAKE2b-256 |
1a8f2005f1235eead4f8c158be03103b6aaa0eb6f4afae355bb3b95bd375cd91
|
Provenance
The following attestation bundles were made for python_mister_fpga-0.1.1.tar.gz:
Publisher:
release.yml on hudsonbrendon/python-mister-fpga
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_mister_fpga-0.1.1.tar.gz -
Subject digest:
035cd75c2e24af16a9b948b24527ecbedaed255cdf87ff78616de2af2894ffed - Sigstore transparency entry: 1679798935
- Sigstore integration time:
-
Permalink:
hudsonbrendon/python-mister-fpga@033106ba7186f6a6f91317d73f917d2456cdcbcd -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/hudsonbrendon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@033106ba7186f6a6f91317d73f917d2456cdcbcd -
Trigger Event:
release
-
Statement type:
File details
Details for the file python_mister_fpga-0.1.1-py3-none-any.whl.
File metadata
- Download URL: python_mister_fpga-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
315511b7970bcf0950b4f61620456c24737abff87a739b5aa218be4b6ebbf788
|
|
| MD5 |
790234cf20454c6b1f58de6cd99523c9
|
|
| BLAKE2b-256 |
dcbdc596d10e7c227bd6870b7d828a959216a61d955a4d18e6679f661d4f7f72
|
Provenance
The following attestation bundles were made for python_mister_fpga-0.1.1-py3-none-any.whl:
Publisher:
release.yml on hudsonbrendon/python-mister-fpga
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_mister_fpga-0.1.1-py3-none-any.whl -
Subject digest:
315511b7970bcf0950b4f61620456c24737abff87a739b5aa218be4b6ebbf788 - Sigstore transparency entry: 1679799012
- Sigstore integration time:
-
Permalink:
hudsonbrendon/python-mister-fpga@033106ba7186f6a6f91317d73f917d2456cdcbcd -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/hudsonbrendon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@033106ba7186f6a6f91317d73f917d2456cdcbcd -
Trigger Event:
release
-
Statement type: