Skip to main content

LG Soundbar Bluetooth

CI Status Documentation Status Test coverage percentage

Poetry ruff pre-commit

PyPI Version Supported Python versions License

Control LG soundbars over Bluetooth.

LG soundbars such as the G1 have no network connection, but they can be controlled over Bluetooth Classic, through a serial link (RFCOMM, the Serial Port Profile). This library speaks the soundbar's Bluetooth serial protocol, in your own asyncio event loop:

  • volume, mute, inputs and sound modes;
  • the soundbar's settings (levels, dynamic range control, night mode, auto power and more), offered where its feature flags say it has them;
  • the subwoofer and rear speakers' connection, firmware versions and the model;
  • turning the soundbar off, and switching back to the input it was on when a connection moved it to Bluetooth.

The Bluetooth link comes from bluetooth-classic, which provides serialx's rfcomm:// handler; the client opens the link through serialx, as serial devices in Home Assistant are. For LG soundbars with Wi-Fi, see temescal. The protocol is documented in docs/protocol.md.

Installation

Install this via pip (or your favourite package manager):

pip install lg-soundbar-bluetooth

It needs Linux with Bluetooth sockets in Python (as Home Assistant's Python has), and Python 3.12 or newer. The soundbar must be paired first; to pair from Python, use bluetooth-classic.

Usage

import asyncio

from lg_soundbar_bluetooth import LGSoundbar, function_name


async def main() -> None:
    soundbar = LGSoundbar("00:11:22:33:44:55")
    await soundbar.connect(keep_input=True)
    state = soundbar.state
    print(function_name(state.function), state.volume, state.sound_mode)
    await soundbar.set_volume(12)
    await soundbar.disconnect()


asyncio.run(main())

Connecting wakes a soundbar that is off, and moves one that is on to its Bluetooth input; with keep_input=True the client switches it straight back, makes sure it got there, and reports how in input_restore. lg_soundbar_bluetooth.testing.FakeSoundbar stands in for a soundbar in tests.

Finding and pairing a soundbar

from bluetooth_classic import BluetoothClassic

from lg_soundbar_bluetooth import is_lg_soundbar


async def find() -> None:
    async with BluetoothClassic() as bluetooth:
        await bluetooth.discover()
        for device in await bluetooth.devices():
            if is_lg_soundbar(device.name, device.uuids, paired=device.paired):
                await bluetooth.pair(device.address)
                await bluetooth.trust(device.address)

Contributing

See CONTRIBUTING.md.

Credits

Message formats were cross-checked against frames captured by websterwh/lg-s75qr. No LG code is included. The project layout and tooling follow the Bluetooth-Devices libraries, which were created with browniebroke/cookiecutter-pypackage.

Metadata

Release files for lg-soundbar-bluetooth 0.4.3

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

Source distribution (sdist)

Source distribution for lg-soundbar-bluetooth 0.4.3
File Size Uploaded Provenance Actions
lg_soundbar_bluetooth-0.4.3.tar.gz 34.9 kB With provenance Details for lg_soundbar_bluetooth-0.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lg-soundbar-bluetooth 0.4.3
File Interpreter ABI Platform Actions
lg_soundbar_bluetooth-0.4.3-py3-none-any.whl Python 3 none any Details for lg_soundbar_bluetooth-0.4.3-py3-none-any.whl

Total release size: 72.3 kB

Release files / lg_soundbar_bluetooth-0.4.3.tar.gz

Download URL lg_soundbar_bluetooth-0.4.3.tar.gz
Size 34.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8355e10c5604508411ffef249c13f74feae6e4e10baa7adc8a610e12e62149e6
BLAKE2b-256 checksum
How to use checksums
e47cb8e50e411cdfb539158c9ec8de25697f866758598e059d8db6927f83eff3
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 25, 2026.

Transparency log

Release files / lg_soundbar_bluetooth-0.4.3-py3-none-any.whl

Download URL lg_soundbar_bluetooth-0.4.3-py3-none-any.whl
Size 37.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e4e095571a8cff97f757545432ec942d197937f34c450666e9332e86abffd08
BLAKE2b-256 checksum
How to use checksums
f4b349518662e9276141848c97cec47b19de4ed4e7741006084057037d100a2e
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 25, 2026.

Transparency log

Security for lg-soundbar-bluetooth 0.4.3

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 lg_soundbar_bluetooth-0.4.3.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 25, 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.

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