Skip to main content

BarTalk

Talk to LG Wi-Fi soundbars without losing track of their power state.

BarTalk replaces the archived Temescal 0.5 client. It comes from a Home Assistant custom fix for an LG S95Q that could leave HA showing on after the soundbar was switched off manually. It runs inside your Python application, not as a separate service.

Install

Python 3.10 or newer is required.

python -m pip install lg-bartalk

Use

from lg_bartalk import LGSoundbarClient

speaker = LGSoundbarClient("192.0.2.1", callback=print)
try:
    speaker.get_info()
    speaker.set_volume(17)
finally:
    speaker.close()

Pass a callback to receive decoded responses on the client's listener thread. Always call close() when finished. Commands are synchronous; async applications should run construction, commands and cleanup in an executor.

Switching from Temescal

Change the import; keep your existing calls:

import lg_bartalk as temescal

speaker = temescal.temescal("192.0.2.1", port=9741, callback=print, logger=None)
speaker.set_func(temescal.E_ARC)
speaker.set_eq(eq=temescal.CINEMA)
speaker.close()

The Temescal 0.5 constructor, public methods, keyword arguments, tables and numeric constants are retained and tested against the original library. encrypt_packet() still returns a complete wire frame. The old package is only used by compatibility tests; it is not a runtime dependency.

Unlike Temescal's silent send failures, failed commands raise OSError after one reconnect attempt, and malformed payloads raise ValueError when decrypted directly. Only one listener can run at a time. Direct manipulation of Temescal's socket/thread internals is not a supported migration path.

When does it check?

  • Normally it waits for soundbar notifications instead of polling.
  • A new connection has five seconds to supply its first valid response.
  • While power is on or unknown, 30 seconds without data triggers a reconnect and state request.
  • After a reported shutdown, five idle seconds trigger one reconnect to restore the listener.
  • Once off is confirmed on that connection, recurring state requests stop.
  • Broken or unresponsive sessions reconnect with increasing retry delays, capped at 30 seconds.

A valid response resets the retry delay. Models without power-status messages use the normal 30-second idle deadline instead of repeatedly reconnecting every five seconds.

It reads complete TCP frames, so split reads cannot silently discard an update. Idle receive deadlines while off send no traffic; socket deadlines also bound commands. No HA polling automation is needed. Device support follows Temescal's protocol; the original fix was exercised on an S95Q, not every LG model. LG's fixed protocol key is not network authentication; use this on a trusted LAN.

Development

python -m pip install -e '.[test]'
python -m unittest discover -s tests -v

License

Apache-2.0. Protocol constants and command payloads retain Google's original attribution in NOTICE.

Metadata

Release files for lg-bartalk 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 lg-bartalk 0.1.1
File Size Uploaded Provenance
lg_bartalk-0.1.1.tar.gz 18.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for lg-bartalk 0.1.1
File Interpreter ABI Platform
lg_bartalk-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.7 kB

Release files / lg_bartalk-0.1.1.tar.gz

Download URL lg_bartalk-0.1.1.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a6fd52a6ff8af41eb6893d2df33f4a10feb7f2712b1a55810ccd94d28063860c
BLAKE2b-256 checksum
How to use checksums
b806f13b90423594ca7fda935a4dda8622c511b90bb08c8a1c9eeafd64bf3b6d
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 Oct 25, 2026.

Transparency log

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

Download URL lg_bartalk-0.1.1-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e096a904e90a2d1defca109a948f72e351f9cee8ae37c18707eab49a8e0694a9
BLAKE2b-256 checksum
How to use checksums
d1d188dade9ae1dbedc9c76d685f4e054357a82abab0dc8b8c98240c9070b9c4
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 Oct 25, 2026.

Transparency log

Security for lg-bartalk 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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lg_bartalk-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 Oct 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.

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