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.0.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.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pybravia-0.5.0.tar.gz
Algorithm Hash digest
SHA256 db392f7388607f439a3917fceb18453270cec548f0226994f24f15619562f551
MD5 bc99828f186360af670c4bc24f2bac86
BLAKE2b-256 e9ad2d189e9ab8623adf4fabdfad942561644f12f4b987c308524b70f727272e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pybravia-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0dabede8ec3c9bc6bf7f0a8fa7928dd5f9d23b8c8178799a9928390e5733b18c
MD5 06a4f727b0cb9aa8ca4a98e910105746
BLAKE2b-256 e366d7fe22e77d07bad9562f35d9435bc88ab95e192b2c4700fd5c7d9dfd9724

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page