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 devicezones— List of zone (listening area) names configured on the deviceport— 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 pollingawait device.disconnect()— Disconnect and clean updevice.get_all_states() -> dict[str, ZoneState]— Get a copy of all zone statesdevice.get_zone_state(zone_name) -> ZoneState— Get a copy of a single zone's stateawait device.set_volume(zone_name, volume_db)— Set zone volume in dBawait device.set_mute(zone_name, mute_on)— Set zone mute stateawait device.set_source(zone_name, source_index)— Set zone input sourcedevice.subscribe_updates(callback)— Register for zone state change callbacksdevice.unsubscribe_updates(callback)— Unregister a state change callbackdevice.subscribe_availability(callback)— Register for connection status callbacksdevice.unsubscribe_availability(callback)— Unregister a connection status callback
Properties:
device.host: str— Device hostname/IPdevice.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 exceptionBoseCSPConnectionError— Connection failuresBoseCSPCommandError— 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
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 py_bose_csp-0.3.0.tar.gz.
File metadata
- Download URL: py_bose_csp-0.3.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
013ae1c2f21a25934effcc7ff14e200ebf32da7e355385ceb46d4efd0832b65d
|
|
| MD5 |
dc0472f25cde427137e20fba3f3f0632
|
|
| BLAKE2b-256 |
c70e3b2dc4ac8e8596fd8cc865c932c21ec01328e14456817ef344d7552dc2cd
|
Provenance
The following attestation bundles were made for py_bose_csp-0.3.0.tar.gz:
Publisher:
publish.yml on BWilky/py-bose-csp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_bose_csp-0.3.0.tar.gz -
Subject digest:
013ae1c2f21a25934effcc7ff14e200ebf32da7e355385ceb46d4efd0832b65d - Sigstore transparency entry: 1863180310
- Sigstore integration time:
-
Permalink:
BWilky/py-bose-csp@961ff4b054afd365c54d2f947990992348a259b3 -
Branch / Tag:
refs/tags/v.0.3.0 - Owner: https://github.com/BWilky
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@961ff4b054afd365c54d2f947990992348a259b3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file py_bose_csp-0.3.0-py3-none-any.whl.
File metadata
- Download URL: py_bose_csp-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.3 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 |
0a84c677596aa6e494a074a931f34b431cb25b1b08467c80dd164fd9c0c35d82
|
|
| MD5 |
0c44300f1f4cf14829c99eb5b06470fb
|
|
| BLAKE2b-256 |
c1295fc535f62768e7d9311a2a4619ed51f8fcd3d7eca120e3e3d9b66611d814
|
Provenance
The following attestation bundles were made for py_bose_csp-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on BWilky/py-bose-csp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_bose_csp-0.3.0-py3-none-any.whl -
Subject digest:
0a84c677596aa6e494a074a931f34b431cb25b1b08467c80dd164fd9c0c35d82 - Sigstore transparency entry: 1863180527
- Sigstore integration time:
-
Permalink:
BWilky/py-bose-csp@961ff4b054afd365c54d2f947990992348a259b3 -
Branch / Tag:
refs/tags/v.0.3.0 - Owner: https://github.com/BWilky
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@961ff4b054afd365c54d2f947990992348a259b3 -
Trigger Event:
release
-
Statement type: