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.5.0.tar.gz (346.6 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.5.0-py3-none-any.whl (275.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blueretro_ble-0.5.0.tar.gz
  • Upload date:
  • Size: 346.6 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.5.0.tar.gz
Algorithm Hash digest
SHA256 59891d1e34fbce7c21647bbc6c9eddd27b766d66bccfab1c7684c93f508e3b49
MD5 80c2119138a1210d07ca122c88957c8e
BLAKE2b-256 5aeb31974df938cba43bd313d5281a7a8ec0e97ed8fe86dd39c3dad7dcd0f3b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for blueretro_ble-0.5.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.5.0-py3-none-any.whl.

File metadata

  • Download URL: blueretro_ble-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 275.1 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 866b9f272d3e868d360bad4bfbc20e27bbeb197f57775b98344f6b2e0b08877d
MD5 b125e7fddcd48d724933328eee8f0e11
BLAKE2b-256 988e81e085f0158efe38d59cc378b264db6eb00be74f54e47bd91ea3a46d405d

See more details on using hashes here.

Provenance

The following attestation bundles were made for blueretro_ble-0.5.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