Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pybravia

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pybravia

Python async library for remote control of Sony Bravia TVs 2013 and newer.

  • 0.3.4
  • PyPI
  • Socket score

Maintainers
1

pybravia

PyPi release GitHub Workflow Status MIT License Code style

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.8 and higher.

Installation

pip install pybravia

Connect and API usage

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()

Contributing

See an issue? Have something to add? Issues and pull requests are accepted in this repository.

License

This project is released under the MIT License. Refer to the LICENSE file for details.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc