Roku
====
Some notes on controlling Roku devices over TCP/IP.
Connecting
----------
To send a command to the Roku, do an HTTP GET or POST to a URL
of the form ``"http://{ipaddress}:8060{path}"``.
.. important:: Using a hostname will not work. You must use the raw IP address. More specifically, unless the Host: header in the HTTP request contains the IP address (not a hostname), the Roku will always return a 403 error.
E.g. to send a remote key (see below), "{path}" looks
like ``"/keypress/{key}"``.
Remote
------
Names of keys that can be used in the API::
Home Rev Fwd Play Select Left Right Down Up
Back InstantReplay Info Backspace Search Enter
VolumeDown VolumeMute VolumeUp PowerOn PowerOff
ChannelUp ChannelDown InputTuner InputHDMI1
InputHDMI2 InputHDMI3 InputHDMI4 InputAV1
HTTP POST to ``/keypress/{keyname}``
Power
-----
To power on or off, send the PowerOn or PowerOff key.
Change apps (channel)
---------------------
To go home, send the Home key.
Otherwise, use a POST ``/launch/{id}``, where {id} is an id
value returned by the query apps command (below).
Device info
-----------
``GET /query/device-info`` and you'll get a response like the one
below.
The most useful thing here is the power status, e.g.
``"Ready"``. The power is ON if you
get ``"PowerOn"``, and otherwise OFF.
Example response::
298c0003-680f-102c-803a-c0d2f363466b
.........
.........
..........
TCL
55R615
7120X
US
true
false
55
20
1080p
ATSC
true
............
realtek
false
true
true
............
ethernet
55" TCL Roku TV
TCL•Roku TV
TCL•Roku TV - ...........
55" TCL Roku TV
here
30C.00E04193A
11.0.0
4193
true
en
US
en_US
true
US/Eastern
United States/Eastern
America/New_York
-240
24-hour
343238
Ready
true
false
true
true
true
..............
true
true
true
true
true
true
true
true
false
false
1.0
true
true
true
true
true
true
support.tcl.com/us
7.2.53
3.0
6.0.15
2.8.20
1.0
Query apps
----------
Active app
..........
``GET /query/active-app``
Roku off. Or Roku on Home Screen, no screen saver.::
$ curl http://192.168.1.134:8060/query/active-app
Roku
The ``/query/active-app`` command if the user is in the homescreen but the default screensaver is active.::
$ curl http://192.168.1.134:8060/query/active-app
Roku
Default screensaver
The ``/query/active-app`` command if the user is in the Netflix app.::
$ curl http://192.168.1.134:8060/query/active-app
Netflix
The ``/query/active-app`` command if the user is in the Roku Media Player with an active screensaver.::
$ curl http://192.168.1.134:8060/query/active-app
Roku Media Player
Roku Digital Clock
To get a list of all apps, ``GET /query/apps``.
Example response querying all apps::
Computer
Live TV
Netflix
Prime Video
Pandora
TuneIn
YouTube
The Roku Channel
PBS
Roku Media Player
HBO Max
Emby
QVC & HSN
WRAL-TV North Carolina
IMDb TV
adult swim
WeatherNation
ABC News Live
CBS News
Radio by myTuner
vTuner Internet Radio
NBC News
My Music
ABC11 North Carolina
4K Views
Railroads Unlimited
The Train Channel