Skip to main content

pybravia

PyPi release GitHub Workflow Status MIT License

Python Bravia provides an easy-to-use async interface for controlling of Sony Bravia TVs 2013 and newer.

This library primarily being developed with the intent of supporting Home Assistant.

For more information, take a look at BRAVIA Professional Display Knowledge Center.

Requirements

This library supports Python 3.10 and higher.

Installation

pip install pybravia

Connect and API usage

With PSK (recommended)

import asyncio
import logging

from pybravia import BraviaClient, BraviaError

HOST = "192.168.1.20"
PSK = "sony"

logging.basicConfig(level=logging.DEBUG)


async def main():
    """Example of connect with PSK."""
    async with BraviaClient(HOST) as client:
        try:
            connected = await client.connect(psk=PSK)
            info = await client.get_system_info()

            print(info)

            await client.volume_up()
        except BraviaError:
            print("Could not connect")


loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.close()

With PIN code

Start pairing process and display PIN on the TV

import asyncio
import logging

from pybravia import BraviaClient, BraviaError

HOST = "192.168.1.20"
CLIENTID = "MyClientID"
NICKNAME = "MyNicknameID"

logging.basicConfig(level=logging.DEBUG)


async def main():
    """Pairing process initialization example."""
    async with BraviaClient(HOST) as client:
        try:
            await client.pair(CLIENTID, NICKNAME)
        except BraviaError:
            print("Could not connect")


loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.close()

Connect and usage

import asyncio
import logging

from pybravia import BraviaClient, BraviaError

HOST = "192.168.1.20"
CLIENTID = "MyClientID"
NICKNAME = "MyNicknameID"
PIN = "2170"

logging.basicConfig(level=logging.DEBUG)


async def main():
    """Example of connect with PIN."""
    async with BraviaClient(HOST) as client:
        try:
            connected = await client.connect(pin=PIN, clientid=CLIENTID, nickname=NICKNAME)
            info = await client.get_system_info()

            print(info)

            await client.volume_up()
        except BraviaError:
            print("Could not connect")


loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.close()

License

The MIT License (MIT)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybravia-0.5.1.tar.gz (93.6 kB view details)

Uploaded Source

Built Distribution

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

pybravia-0.5.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file pybravia-0.5.1.tar.gz.

File metadata

  • Download URL: pybravia-0.5.1.tar.gz
  • Upload date:
  • Size: 93.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pybravia-0.5.1.tar.gz
Algorithm Hash digest
SHA256 15fdda5f2aa9efea2cf52ef934a3d668ff994542028fe75b652f42892da6af4d
MD5 ee9e8dd78748ad55f7509256ec4438b7
BLAKE2b-256 96db63f80e9f0fe4941fa687c280f5b0fb0f5a04024111c96d0565e4b9fa7e3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybravia-0.5.1.tar.gz:

Publisher: publish.yml on Drafteed/pybravia

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

File details

Details for the file pybravia-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: pybravia-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pybravia-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11453d2a5f515c68359afa45df66af150d787bf47212d31beb3086c3015bdf59
MD5 29861b3cb911bc9daf8bb9948ab28ccf
BLAKE2b-256 b861ef75dd2e951a2abf397f715a616b9e7568d9d99a734a2f0fdc66c4ef0e36

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybravia-0.5.1-py3-none-any.whl:

Publisher: publish.yml on Drafteed/pybravia

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 Sentry Error logging StatusPage Status page