Skip to main content

BLE library for the BlueRetro retro-console Bluetooth adapter

Project description

BlueRetro

blueretro-ble

CI PyPI Python License: MIT

Talk to a BlueRetro retro-console Bluetooth adapter over Bluetooth LE from Python — read its status and current game, read and change the global/output config, and reboot or deep-sleep it.

This library powers the BlueRetro Home Assistant integration, but works standalone in any async Python project (or straight from the command line).

Features

  • 🔌 Async BLE control built on bleak + bleak-retry-connector — works on Linux, macOS, and Windows.
  • 📊 Read device state — firmware, ABI version, BD address, current game id + resolved game name, and config source.
  • ⚙️ Read & write config — system, multitap, pairing mode and memory-card bank (global config), plus per-output device mode and accessory.
  • 🔁 Commands — reboot, deep sleep, and factory reset.
  • 🔍 Discovery helperdiscover() finds nearby BlueRetro adapters.
  • 🖥️ CLIblueretro scan / info / reboot / sleep for quick testing.
  • 🏷️ Bundled game database — resolves a Game ID to a human-readable name.

Requirements

  • Python 3.11 or newer.
  • A Bluetooth LE adapter (built-in or USB).
  • A BlueRetro adapter, reachable only while idle (no controller connected).

Installation

pip install blueretro-ble

CLI usage

blueretro scan                          # find nearby adapters
blueretro info AA:BB:CC:DD:EE:FF        # connect and print the full state
blueretro reboot AA:BB:CC:DD:EE:FF      # reboot the adapter
blueretro sleep AA:BB:CC:DD:EE:FF       # put the adapter into deep sleep

Library usage

import asyncio
from blueretro_ble import BlueRetroDevice, discover

async def main():
    devices = await discover()
    device = BlueRetroDevice()
    state = await device.async_update(devices[0])
    print(state.fw_version, state.system, state.game_name)

    # change the emulated accessory on output port 1
    await device.async_set_output_config(devices[0], 0, accessory="Memory")

asyncio.run(main())

BlueRetroDevice methods accept a bleak BLEDevice (e.g. from Home Assistant's shared scanner or an ESPHome Bluetooth proxy). async_update connects, reads everything, always disconnects, and never raises — on failure it returns a BlueRetroState(available=False).

How it works

BlueRetro exposes a GATT service whose characteristics carry the configuration and a command channel; blueretro_ble reads/decodes them and sends 1-byte commands.

  • Service UUID: 56830f56-5180-fab0-314b-2fa176799a00
  • The configuration is only reachable while the adapter is idle (no controller paired).
  • The protocol is reverse-engineered from the official BlueRetroWebCfg. See HARDWARE.md for the full notes.

Limitations

  • The adapter only accepts connections while idle — during gameplay async_update returns an unavailable state.
  • Dreamcast VMU (memory card) transfer needs a large BLE MTU; over stacks stuck at MTU 23 it is unreliable — use the official web config for VMU backup/restore.

Contributing

See CONTRIBUTING.md.

License

MIT © Hudson Brendon

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

blueretro_ble-0.7.0.tar.gz (354.2 kB view details)

Uploaded Source

Built Distribution

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

blueretro_ble-0.7.0-py3-none-any.whl (279.7 kB view details)

Uploaded Python 3

File details

Details for the file blueretro_ble-0.7.0.tar.gz.

File metadata

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

File hashes

Hashes for blueretro_ble-0.7.0.tar.gz
Algorithm Hash digest
SHA256 6eba0d3644826ad82ed6fab159c0a12de3e34dd61723938e8986b35b3d1259f9
MD5 c0bad81ff3a0579e5682cc9090bd5baa
BLAKE2b-256 e9921bb14168c4dd8d4a4ec5526594aa4c267e16c4033e261766c0d0d8431b59

See more details on using hashes here.

Provenance

The following attestation bundles were made for blueretro_ble-0.7.0.tar.gz:

Publisher: publish.yml on hudsonbrendon/blueretro-ble

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

File details

Details for the file blueretro_ble-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: blueretro_ble-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 279.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for blueretro_ble-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20c581d9efe0b8254b26b9850c1d5c2e1f480d0aa37ef945f79b7048b5da4f4b
MD5 00b7d3a5010ecb9e04cc4ba450d935ce
BLAKE2b-256 e9c034ebc0a7209f2f1ad2b8ef5ef5c0df9bf100c6d44f476a9b95a7f7baca84

See more details on using hashes here.

Provenance

The following attestation bundles were made for blueretro_ble-0.7.0-py3-none-any.whl:

Publisher: publish.yml on hudsonbrendon/blueretro-ble

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