A simple Python application to control a Roku TV using ECP-based commands. This is an on-the-side WIP, so feel free to create Issues and/or PRs as they are encountered.
Current support is power on/off, home, back, select+4 direction dpad, select input, pause/play, fast-forward, rewind, volume up/down/mute, channel up/down, type text to tv
-
Download and Install Python (e.g., Python 3.8.8 for Windows). Also, install git.
-
Clone the repository (or download and extract the zip file):
git clone git@github.com:jhpohovey/simple-remote.git -
Navigate to the project directory:
cd simple-remote -
Create a virtual environment :
- On Windows:
python -m venv venv
- On macOS and Linux:
python3 -m venv venv
-
[only if you did 3.] Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS and Linux:
source venv/bin/activate
- On Windows:
-
Install the required packages:
pip install -r requirements.txt
-
Run the script with the IP address of your Roku TV:
python remote_gui.py --ip <ROKU_TV_IP_ADDRESS> --port <ROKU_TV_IP_PORT>
-
If no IP address or Port is specified, the default IP address
192.168.50.59and default port8060will be used:python remote_gui.py
You can also enable logging to act as troubleshooting with
--enable_logging -
Use the GUI to control the Roku TV.
-
Create an executable:
pyinstaller --onefile remote_gui.py
-
The executable will be generated in the
distdirectory. -
Run the executable with the IP address of your Roku TV:
./dist/remote_gui --ip <ROKU_TV_IP_ADDRESS>
-
If no IP address is specified, a default IP address will be used:
./dist/remote_gui
-
To enable logging, add the
--enable_loggingflag:./dist/remote_gui --ip <ROKU_TV_IP_ADDRESS> --enable-logging
-
Press
Win + R, typeshell:startup, and press Enter. -
Copy the shortcut of the executable generated by
PyInstallerto the startup folder.
The application will now run automatically when the computer starts.
powerOn: Turn on the TVpowerOff: Turn off the TVkeyup: Simulate a keyup eventvolumeUp: Increase the volumevolumeDown: Decrease the volumehome: Go to the home screenback: Go backselect: Select an itemup: Navigate updown: Navigate downleft: Navigate leftright: Navigate rightplay: Play mediapause: Pause mediarewind: Rewind mediafastForward: Fast forward mediainfo: Show information
Add more commands as needed by extending the RokuRemote class.
To enable logging, use the --enable_logging flag when running the script:
python roku_remote.py --ip <ROKU_TV_IP_ADDRESS> --enable_loggingYou can adjust the logging level manually for further development by modifying the basicConfig call in the roku_remote.py and remote_gui.py files. For example, to set the logging level to DEBUG, use:
logging.basicConfig(level=logging.DEBUG)The GUI layout has been modified to look more like a remote by arranging the buttons in a grid layout and using programmatically created buttons.
By following these steps, you will be able to visualize and interact with a more remote-like GUI for your Roku remote application using pygame.
By following these steps, you will be able to create and run a pygame GUI for your Roku remote application without needing to provide images. The buttons will be created programmatically.
By following these steps, you will be able to create a circular power button with the power logo on it, along with other rectangular buttons for the rest of the remote functionalities.
Below is a basic visual representation of the remote interface. It is quite rudimentary but should accomplish its purpose.
