Skip to main content

Async Python library for controlling Bose CSP audio devices over TCP.

Project description

py-bose-csp

Async Python library for controlling Bose CSP (Commercial Sound Processor) audio devices over TCP.

Installation

pip install py-bose-csp

Quick Start

import asyncio
from pybosecsp import BoseCSPDevice, ZoneState

async def main():
    device = BoseCSPDevice("192.168.1.100", ["Zone1", "Zone2"])

    await device.connect()

    # Get current state
    state: ZoneState = device.get_zone_state("Zone1")
    print(f"Volume: {state.volume}, Muted: {state.is_muted}, Source: {state.current_source}")

    # Control the device
    await device.set_volume("Zone1", -20.0)
    await device.set_mute("Zone1", True)
    await device.set_source("Zone1", 2)

    # Subscribe to state changes
    def on_update(zone_name: str) -> None:
        new_state = device.get_zone_state(zone_name)
        print(f"{zone_name} updated: {new_state}")

    device.subscribe_updates(on_update)

    # Subscribe to availability changes
    def on_availability(is_available: bool) -> None:
        print(f"Device available: {is_available}")

    device.subscribe_availability(on_availability)

    # ... keep running ...

    await device.disconnect()

asyncio.run(main())

API Reference

BoseCSPDevice(host, zones, port=10055)

Main device class. Creates a TCP connection to a Bose CSP device.

Parameters:

  • host — IP address or hostname of the device
  • zones — List of zone (listening area) names configured on the device
  • port — TCP port (default: 10055)
  • reconnect_delay — Seconds between reconnection attempts (default: 5)
  • volume_interval — Seconds between volume polls (default: 5)
  • other_interval — Seconds between mute/source polls (default: 30)

Methods:

  • await device.connect() — Connect and start polling
  • await device.disconnect() — Disconnect and clean up
  • device.get_all_states() -> dict[str, ZoneState] — Get a copy of all zone states
  • device.get_zone_state(zone_name) -> ZoneState — Get a copy of a single zone's state
  • await device.set_volume(zone_name, volume_db) — Set zone volume in dB
  • await device.set_mute(zone_name, mute_on) — Set zone mute state
  • await device.set_source(zone_name, source_index) — Set zone input source
  • device.subscribe_updates(callback) — Register for zone state change callbacks
  • device.unsubscribe_updates(callback) — Unregister a state change callback
  • device.subscribe_availability(callback) — Register for connection status callbacks
  • device.unsubscribe_availability(callback) — Unregister a connection status callback

Properties:

  • device.host: str — Device hostname/IP
  • device.is_connected: bool — Current connection status

ZoneState

Dataclass representing a zone's state:

  • volume: float — Current volume in dB (default: 0.0)
  • is_muted: bool — Mute state (default: False)
  • current_source: int — Active source index (default: 0)

Exceptions

  • BoseCSPError — Base exception
  • BoseCSPConnectionError — Connection failures
  • BoseCSPCommandError — Command failures

Protocol

This library implements the Bose CSP serial control protocol over TCP (default port 10055). See the Bose CSP Serial Control Guide for full protocol documentation.

License

MIT

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

py_bose_csp-0.3.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

py_bose_csp-0.3.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file py_bose_csp-0.3.1.tar.gz.

File metadata

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

File hashes

Hashes for py_bose_csp-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e34cf8e580a76dbe289c15829b1e40a726fd55cb2f9c3a336032602a3c1018e6
MD5 b518ce55c50d49ac08212a30ee1c4022
BLAKE2b-256 30220b04c19b76260d4d1b8fae1f37c66af384d65fbf9f53883a86b902d849e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_bose_csp-0.3.1.tar.gz:

Publisher: publish.yml on BWilky/py-bose-csp

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

File details

Details for the file py_bose_csp-0.3.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for py_bose_csp-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 829be2636d991cbbd8d6cfc929b9129321cfea1ecaad67f491fb97766507cfe8
MD5 0da12826b1e84af3fa7835c22dc90cfe
BLAKE2b-256 ddc9186ee0d2c50ca8eb123600cae9ebe3ddb9427a7021148eedef4f5644bd00

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_bose_csp-0.3.1-py3-none-any.whl:

Publisher: publish.yml on BWilky/py-bose-csp

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