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:
Home
Select
// Select or OKUp
Down
Left
Right
Back
Fwd
Rev
Play
// Play and pauseInstantReplay
Info
// Info or *VolumeUp
VolumeDown
VolumeMute
Search
Enter
Lit_{urlencode key/character}
// Send arbitrary keys URL encodedInputSource
Power
Backspace
Game
Sleep
ClosedCaption
PowerOn
PowerOff
InputAV1
InputHDMI1
InputHDMI2
InputHDMI3
InputHDMI4
InputTuner
Partner1
// 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