Python remote control for Sony Bravia TV
| Author | Denis Machard d.machard@gmail.com |
| License | MIT |
| PyPI | https://pypi.org/project/sonybravia-remotecontrol/ |
This is a Python remote control gateway for Sony Bravia TV with minimal but sufficient basic controls. This remote control acts as a websocket Gateway of the Simple IP API for more reactivity. More details on Simple IP control https://pro-bravia.sony.net/develop/integrate/ssip/overview/index.html
Table of contents
Installation
pip install sonybraviatv_remotecontrol
Start remote control
As prerequisite configure your TV,
-
Enable remote device control
[HOME] Settings > Network > Home network setup > Renderer > Renderer function > Enable [Default: Enable] -
Enable “Simple IP control”
[HOME] Settings > Network > Home network setup > IP control > Simple IP control > Enable [Default: Disable]
After that, you can start the remote control and provides the address IP of your Sony bravia TV.
sonybraviatv_remotecontrol --help
usage: sonybraviatv_remotecontrol [-h] [--destport DESTPORT] [--desthost DESTHOST]
[--bindport BINDPORT] [--bindhost BINDHOST]
optional arguments:
-h, --help show this help message and exit
--destport DESTPORT destination backend tcp port default=20060
--desthost DESTHOST destination backend host address default=127.0.0.1
--bindport BINDPORT bind on port default=8081
--bindhost BINDHOST bind on host default=0.0.0.0
Available buttons
To interact with the remote control, you need to use a websocket client and
send the following JSON commands to the address ws://<remotecontrol_ip>:8081.
Power ON/OFF
{"button": "press_poweron"} // press on power on button
{"button": "press_poweroff"} // press on power off button
Channel selection
{"button": "press_channel<id>"} // press on channel<1...XX> button
Volume
{"button": "press_volup"} // press on volume up button
{"button": "press_voldown"} // press on volume down button
{"button": "press_mute"} // press on mute button
TV Navigation
{"button": "press_up"} // press on up button
{"button": "press_down"} // press on down button
{"button": "press_left"} // press on left button
{"button": "press_right"} // press on right button
{"button": "press_back"} // press on back button
{"button": "press_confirm"} // press on confirm button
HDMI selection
{"button": "press_hdmi<id>"} // press on channel<1..4> button
Miscs buttons
{"button": "press_netflix"} // press on netflix button
{"button": "press_home"} // press on home button
Websocket client
Basic demo
<html>
<head>
<title>RemoteControl demo</title>
<style type="text/css">
.buttons {
font-size: 1em;
display: flex;
justify-content: center;
}
.button {
padding: 2rem;
border: medium solid;
min-height: 1em;
min-width: 1em;
cursor: pointer;
user-select: none;
}
</style>
</head>
<body>
<div class="buttons">
<div class="poweron button">ON</div>
<div class="poweroff button">OFF</div>
</div>
<script>
var websocket = new WebSocket("ws://localhost:8081/");
var poweron = document.querySelector('.poweron')
var poweroff = document.querySelector('.poweroff')
poweron.onclick = function (event) {
websocket.send(JSON.stringify({button: 'press_poweron'}));
}
poweroff.onclick = function (event) {
websocket.send(JSON.stringify({button: 'press_poweroff'}));
}
</script>
</body>
</html>
Systemd service
Example of system service file for Centos7
vim /etc/systemd/system/sonybraviatv_remotecontrol.service
[Unit]
Description=Sony Bravia TV remote control Service
After=network.target
[Service]
ExecStart=/usr/local/bin/sonybraviatv_remotecontrol --desthost=10.0.0.200
Restart=on-abort
Type=simple
User=root
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start sonybraviatv_remotecontrol
systemctl status sonybraviatv_remotecontrol
systemctl enable sonybraviatv_remotecontrol
Metadata
Release files for sonybraviatv-remotecontrol 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sonybraviatv_remotecontrol-0.3.0.tar.gz | 7.5 kB | Without provenance | Details for sonybraviatv_remotecontrol-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sonybraviatv_remotecontrol-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for sonybraviatv_remotecontrol-0.3.0-py3-none-any.whl |
Total release size: 15.8 kB
Release files / sonybraviatv_remotecontrol-0.3.0.tar.gz
| Download URL | sonybraviatv_remotecontrol-0.3.0.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c96014d1280c16b63cd45643772f777a040ad51a3910a9ae8281d91dab196cfe
|
|
BLAKE2b-256 checksum How to use checksums |
247e1d25f66feff10f38c89767929425920c6df5262ea11414ee88091a499ee4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
|
Release files / sonybraviatv_remotecontrol-0.3.0-py3-none-any.whl
| Download URL | sonybraviatv_remotecontrol-0.3.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
171113799b84fbe293453ffca504605123ff3a54ce31284770005282676caa74
|
|
BLAKE2b-256 checksum How to use checksums |
8e8825f3554b54db65ebc345be1dc8bb537e3b9bf7a732ad2be3487a2ffb7cec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
|
Security for sonybraviatv-remotecontrol 0.3.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.