Skip to main content

opalum-receiver

A small Python library for controlling Opalum speakers / amplifiers over their serial (RS232) protocol. It is modelled on libraries such as nad_receiver and denonavr: a single importable class constructed with a serial port path, with methods for power, volume, mute, source selection and the auto-standby timeout.

Installation

pip install opalum-receiver          # from a package index
pip install -e ".[dev]"              # from a checkout, with test/lint tooling

Runtime dependency: pyserial. On Debian / Ubuntu it is also available as the apt package python3-serial.

Usage

from opalum_receiver import OpalumReceiver

avr = OpalumReceiver("/dev/ttyUSB0")   # opens the port and powers the device on
try:
    avr.set_source("Bluetooth")        # by name (case-insensitive), or index 0-5
    avr.set_volume(30)                 # 0-100 percent
    avr.volume_up()
    avr.mute()                         # sends vol00
    avr.unmute()                       # restores the pre-mute volume
    avr.set_standby_timeout(False)
finally:
    avr.close()

# Or as a context manager:
with OpalumReceiver("/dev/ttyUSB0") as avr:
    avr.power_off()

Every command method returns True when the device acknowledged the command and False otherwise.

Public API

Method Wire command Notes
set_power(on) / power_on() / power_off() pwr1 / pwr0
set_volume(level) volXX level is 0-100 percent; scaled to the device's 0x00-0x63 range
volume_up() / volume_down() vol+ / vol-
mute() vol00 the protocol has no dedicated mute
unmute() volXX restores the remembered pre-mute volume
set_mute(muted) convenience for mute() / unmute()
set_source(source) / set_input(source) srcN name (case-insensitive), numeric string, or int 0-5
set_standby_timeout(enabled) sta1 / sta0
get_power() / get_volume() / get_mute() / get_source() / get_standby_timeout() - cached last-set value, or None if unknown (see below)
available_sources() - ["Toslink1", "Toslink2", "Coaxial", "Bluetooth", "Analog", "Mixer"]
close() - closes the serial port

Sources map to protocol indices as: Toslink1=0, Toslink2=1, Coaxial=2, Bluetooth=3, Analog=4, Mixer=5.

Protocol notes

  • Serial line: 115200 baud, 8 data bits, no parity, 1 stop bit, no flow control.
  • Framing: every command is terminated with a carriage return (\r). The device replies with OK, ER, or an echo of the command. A command is treated as successful when the reply contains OK or echoes the command, and does not contain ER.
  • Volume encoding: the 0-100 percentage is scaled to the device's native 0x00-0x63 (0-99, 100 steps) range with integer truncation (level * 0x63 // 100) and sent as two lowercase hex digits, e.g. vol31.
  • No query commands. The Opalum protocol only confirms writes; it cannot be asked for its current state. The get_* methods therefore return the last value set through this object, or None if it has not been set since construction.
  • Mute is emulated: there is no mute command, so mute() sends vol00 and unmute() re-sends the remembered volume.

Injecting a transport (testing)

The serial transport is separated from the command mapping and can be injected, which is how the offline test suite runs without hardware:

from opalum_receiver import OpalumReceiver
from opalum_receiver.transport import BaseTransport

class FakeTransport(BaseTransport):
    def __init__(self):
        self.requests = []
    def command(self, request):      # return the raw device reply
        self.requests.append(request)
        return "OK"
    def close(self):
        pass

avr = OpalumReceiver(transport=FakeTransport(), power_on=False)

Development

pip install -e ".[dev]"
PYTHONPATH=src python3 -m pytest -q
ruff check src tests

CI (Forgejo Actions) installs the test dependencies hermetically from apt (python3 python3-pytest python3-serial) and runs the same pytest command.

Releasing

Releases are cut as release/x.y.z tags; the published version is derived from the tag. See PUBLISHING.md for the private Forgejo registry and public PyPI (Trusted Publishing) flows.

Credit

The wire protocol (serial settings, command framing, volume/source encoding and value ranges) was ported faithfully from the C++ opalum_serial backend of the alsa-avr-control project.

License

MIT - Martin Munk Hansen. See LICENSE.

Metadata

Release files for opalum-receiver 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opalum-receiver 0.1.1
File Size Uploaded Provenance Actions
opalum_receiver-0.1.1.tar.gz 13.8 kB With provenance Details for opalum_receiver-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opalum-receiver 0.1.1
File Interpreter ABI Platform Actions
opalum_receiver-0.1.1-py3-none-any.whl Python 3 none any Details for opalum_receiver-0.1.1-py3-none-any.whl

Total release size: 24.9 kB

Release files / opalum_receiver-0.1.1.tar.gz

Download URL opalum_receiver-0.1.1.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f5428224f7a914fca774ef3ab593fd2e854598a6bd3dc5b0bc86683e2cafeae1
BLAKE2b-256 checksum
How to use checksums
7c01ba77aaee748a2e817e65a7a44fd97fa5da4ca0e8921f28a5b88e0129afad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / opalum_receiver-0.1.1-py3-none-any.whl

Download URL opalum_receiver-0.1.1-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a12ff9a85dadd018c5eee03ab0ce9468ce1088ed2290894c6ccd9c743f99570a
BLAKE2b-256 checksum
How to use checksums
cd6eb6a313075b97256bbd266e6d6af575a7fc4e2c1153bec3e0278559166af1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for opalum-receiver 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for opalum_receiver-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page