Library to emulate the Roku API for Home Assistant and other automation tools.
Project description
emulated_roku
Library to emulate the Roku API for Home Assistant and other automation tools. Discovery is tested with Logitech Harmony and Android remotes.
Installation
pip install emulated_roku
Requires Python 3.12+.
Usage
Subclass EmulatedRokuCommandHandler to handle key press / down / up events and app launches, then start the server:
import asyncio
import emulated_roku
class MyHandler(emulated_roku.EmulatedRokuCommandHandler):
def on_keypress(self, roku_usn, key):
print(f"Key pressed: {key}")
def launch(self, roku_usn, app_id):
print(f"Launch app: {app_id}")
async def main():
server = emulated_roku.EmulatedRokuServer(
MyHandler(),
"my-roku",
emulated_roku.get_local_ip(),
8060,
)
await server.start()
await asyncio.Event().wait()
asyncio.run(main())
See example.py for a minimal runnable example.
Custom apps
The application list can be customized with a comma- or newline-separated string:
server = emulated_roku.EmulatedRokuServer(
handler, "my-roku", "192.168.1.10", 8060,
custom_apps="1:Netflix,2:YouTube,3:Plex",
)
This produces:
<apps>
<app id="1" version="1.0.0">Netflix</app>
<app id="2" version="1.0.0">YouTube</app>
<app id="3" version="1.0.0">Plex</app>
</apps>
Development
python -m venv .venv
source .venv/bin/activate
pip install -e .[test]
pytest tests/ -v
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file emulated_roku-0.5.1.tar.gz.
File metadata
- Download URL: emulated_roku-0.5.1.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c7834d601fb4725168477c4dc7e87b987ebc2802fd4e3c93d4de6d286dd8a13
|
|
| MD5 |
a6fff8e615f1ee55e6b7561cd1e4ead2
|
|
| BLAKE2b-256 |
fe3291e92fb35ecb375c840052be02fac7e20fd2b4dcc331d747c585a7e8d86b
|
Provenance
The following attestation bundles were made for emulated_roku-0.5.1.tar.gz:
Publisher:
python-publish.yml on martonperei/emulated_roku
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emulated_roku-0.5.1.tar.gz -
Subject digest:
7c7834d601fb4725168477c4dc7e87b987ebc2802fd4e3c93d4de6d286dd8a13 - Sigstore transparency entry: 959180515
- Sigstore integration time:
-
Permalink:
martonperei/emulated_roku@8bd6a550315fe45b6f825a75ab8ba54e6f157b9b -
Branch / Tag:
refs/tags/0.5.1 - Owner: https://github.com/martonperei
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8bd6a550315fe45b6f825a75ab8ba54e6f157b9b -
Trigger Event:
release
-
Statement type:
File details
Details for the file emulated_roku-0.5.1-py3-none-any.whl.
File metadata
- Download URL: emulated_roku-0.5.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5c1ef202eb3e5461966cd1cb8f55800094d0ad86ae72696a273b7f81334a7fa
|
|
| MD5 |
13da5d13775de5c9d70bfefc504a89e5
|
|
| BLAKE2b-256 |
400e5846955da4c53956d03c0d7d74e15522ed3ba0af5c35ce9dd6f302c36d29
|
Provenance
The following attestation bundles were made for emulated_roku-0.5.1-py3-none-any.whl:
Publisher:
python-publish.yml on martonperei/emulated_roku
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emulated_roku-0.5.1-py3-none-any.whl -
Subject digest:
d5c1ef202eb3e5461966cd1cb8f55800094d0ad86ae72696a273b7f81334a7fa - Sigstore transparency entry: 959180615
- Sigstore integration time:
-
Permalink:
martonperei/emulated_roku@8bd6a550315fe45b6f825a75ab8ba54e6f157b9b -
Branch / Tag:
refs/tags/0.5.1 - Owner: https://github.com/martonperei
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8bd6a550315fe45b6f825a75ab8ba54e6f157b9b -
Trigger Event:
release
-
Statement type: