Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emulated_roku-0.5.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emulated_roku-0.5.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

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

Hashes for emulated_roku-0.5.1.tar.gz
Algorithm Hash digest
SHA256 7c7834d601fb4725168477c4dc7e87b987ebc2802fd4e3c93d4de6d286dd8a13
MD5 a6fff8e615f1ee55e6b7561cd1e4ead2
BLAKE2b-256 fe3291e92fb35ecb375c840052be02fac7e20fd2b4dcc331d747c585a7e8d86b

See more details on using hashes here.

Provenance

The following attestation bundles were made for emulated_roku-0.5.1.tar.gz:

Publisher: python-publish.yml on martonperei/emulated_roku

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for emulated_roku-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c1ef202eb3e5461966cd1cb8f55800094d0ad86ae72696a273b7f81334a7fa
MD5 13da5d13775de5c9d70bfefc504a89e5
BLAKE2b-256 400e5846955da4c53956d03c0d7d74e15522ed3ba0af5c35ce9dd6f302c36d29

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page