drafteed / pybravia Goto Github PK
View Code? Open in Web Editor NEWPython async library for remote control of Sony Bravia TVs 2013 and newer.
License: MIT License
Python async library for remote control of Sony Bravia TVs 2013 and newer.
License: MIT License
Does this library work with the Sony UBP-X700? It should as far as I'm aware, but I've just done a quick test to try it out and hit the following error:
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "/opt/homebrew/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 1064, in create
_connection
raise exceptions[0]
File "/opt/homebrew/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 1049, in create
_connection
sock = await self._connect_sock(
File "/opt/homebrew/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 960, in _connec
t_sock
await self.sock_connect(sock, address)
File "/opt/homebrew/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/selector_events.py", line 500, in soc
k_connect
return await fut
File "/opt/homebrew/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/selector_events.py", line 535, in _so
ck_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 61] Connect call failed ('192.168.1.38', 80)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/matthewsimpson/Projects/Drafteed/pybravia/pybravia/client.py", line 154, in send_req
response = await self._session.post(
File "/opt/homebrew/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
conn = await self._connector.connect(
File "/opt/homebrew/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
proto = await self._create_connection(req, traces, timeout)
File "/opt/homebrew/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/opt/homebrew/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
raise last_exc
File "/opt/homebrew/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/opt/homebrew/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.38:80 ssl:default [Connect call failed ('192.168.1.38', 80)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/matthewsimpson/Projects/Drafteed/pybravia/playground.py", line 7, in test
await client.pair("CLIENTID", "NICKNAME")
File "/Users/matthewsimpson/Projects/Drafteed/pybravia/pybravia/client.py", line 105, in pair
await self.register(PAIR_PIN, clientid, nickname)
File "/Users/matthewsimpson/Projects/Drafteed/pybravia/pybravia/client.py", line 95, in register
await self.send_rest_req(
File "/Users/matthewsimpson/Projects/Drafteed/pybravia/pybravia/client.py", line 235, in send_rest_req
return await self.send_req(
File "/Users/matthewsimpson/Projects/Drafteed/pybravia/pybravia/client.py", line 173, in send_req
raise BraviaTVConnectionError from err
pybravia.exceptions.BraviaTVConnectionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/matthewsimpson/Projects/Drafteed/pybravia/playground.py", line 11, in <module>
asyncio.run(test())
File "/opt/homebrew/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/opt/homebrew/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 646, in run_unt
il_complete
return future.result()
File "/Users/matthewsimpson/Projects/Drafteed/pybravia/playground.py", line 8, in test
except BraviaTVError:
NameError: name 'BraviaTVError' is not defined
shell returned 1
I've tried to connect in the past and managed to connect and control it, but I've never been able to package it up and make use of it (aka add it to Home Assistant). My reason for bringing this up is that it should be possible to expand the scope of this library beyond just Bravia TVs and include other devices which can be controlled via IRCC.
EDIT: Also worth noting, the repo I linked to above contains some code related to discovering Sony devices on your network. I'm not sure how Home Assistant is set up for UPNP discovery, but there should at least be some information in there that could be applied to Home Assistant to enable autodiscovery for Sony IRCC devices.
This issue is open for possible discussion of the first release.
Todo list:
Since upgrading to home assistant 2022.9 I can no longer see TV channels listed in the sources of my TV (just inputs and apps) whereas before there was a full list including tv channels
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.