This is a simple CLI tool for sending commands to Roku devices (TVs or boxes) on your local network. It could easily be adapted into another project as well.
- TypeScript:
deno run --allow-net roku-commands.ts {myDevicesIPAddressOrHostname} {command} - Binary:
roku-command {myDevicesIPAddressOrHostname} {command}
deno run --allow-net roku-commands.ts rokuBox123.local PowerOn(see note below)deno run --allow-net roku-commands.ts 192.168.1.234 PowerOff
* Deno DNS lookups can be slow, at least with v1.17. Commands are executed much faster if you use the device's IP address instead.
Roku devices can be easily controlled via an HTTP API. It is accessed by issuing a POST request to http://{device_ip}:8060/keypress/{command}.
Request URL Examples:
- http://192.168.1.123:8060/keypress/Home // Go to Roku home
- http://192.168.1.123:8060/keypress/LIT_A // Send 'a' character/key
- http://192.168.1.123:8060/keypress/LIT_%40 // Send ' ' character/key using URL encoding
Available Commands:
HomeSelect// Select or OKUpDownLeftRightBackFwdRevPlay// Play and pauseInstantReplayInfo// Info or *VolumeUpVolumeDownVolumeMuteSearchEnterLit_{urlencode key/character}// Send arbitrary keys URL encodedInputSourcePowerBackspaceGameSleepClosedCaptionPowerOnPowerOffInputAV1InputHDMI1InputHDMI2InputHDMI3InputHDMI4InputTunerPartner1// NetflixPartner2// PandoraPartner3// CracklePartner4// VUDUPartner5// NOW TVPartner6// Roku Channel StorePartner7// M-GOPartner8// Amazon VideoPartner9// BlockbusterPartner10// RdioPartner11// CinemaNowPartner12// Sling TVPartner13// HuluPartner14// Google PlayPartner15// CinexplexPartner16// YouTubePartner17// Sky StorePartner18// HBO NOWPartner19// ShowtimePartner20// Red Bull TVPartner21// SpotifyPartner22// CBS NewsPartner23// Cinepolis KlicPartner24// TEDPartner25// BLIMPartner26// Playstation VuePartner27// VMediaPartner28// Starz