Author Topic: PLUGIN: RokuControl  (Read 1204 times)

Offline bdparker

  • Newbie
  • *
  • Posts: 15
  • Karma: +1/-0
PLUGIN: RokuControl
« on: January 02, 2018, 02:21:10 pm »
This is my first attempt at writing a luup plugin, and has only been tested with a Roku 3 and a TCL RokuTV on Vera Plus and Vera Lite.  Much of the functionality hasn't been tested at all. This was initially an attempt to simplify turning my Roku on and off, and it kinda got out of hand.

All that being said, it has surpassed my expectations in terms of functionality even though there are a few minor issues I've yet to figure out. I'm putting the code out here for all of you gurus to use, test, modify, and give me feedback. I'm particularly interested in how functional it is on other Roku versions. Keep in mind, I implemented a number of features in the Vera interface that may not be supported by your Roku device, however I found that there were more features supported on my devices than I expected.

Plugin is attached and code is also on github.

Incomplete list of supported actions:
  • on/off
  • volume up/down/mute
  • basically whatever is on your remote
  • launch or install applications
  • search for and launch content
  • change input
  • query active application

When installing the plugin, make sure your Roku is powered on. You'll have to specify its IP address, and it should be set to static either in the Roku or your router's settings. Once the IP is set, the plugin will start querying for information about your device.

**
Attached some screenshots
2018-02-27: Updated description, fixed minor bugs.

***
2018-03-11: The released version of the plugin is now available in the app store.
https://apps.mios.com/plugin.php?id=9041

Additional documentation is available here.
« Last Edit: March 11, 2018, 03:54:59 pm by bdparker »

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1371
  • Karma: +36/-35
Re: PLUGIN: RokuControl
« Reply #1 on: January 02, 2018, 08:57:01 pm »
I have a Roku 3 and will probably use a Harmony Hub to control it and the TV and receiver via Vera someday. I am currently using an old Harmony 600.

I was not aware the Roku 3 could be turned off. Is that just via the API or am I missing something?   
Vera 3, 1.7.1030, CT101, Everspring motion sensor, GE/Jasco switch, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, Weatherunderground, LB60Z-1 bulb, Hue, Alexa

Offline bdparker

  • Newbie
  • *
  • Posts: 15
  • Karma: +1/-0
Re: PLUGIN: RokuControl
« Reply #2 on: January 02, 2018, 09:26:29 pm »
So I had no idea it could be turned off either. It responds to power on, power off, and power toggle commands through the API and turns the TV on and off. The Roku itself actually stays on, which is nice because, unlike my Roku TV, it still responds to queries in that state.

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1371
  • Karma: +36/-35
Re: PLUGIN: RokuControl
« Reply #3 on: January 03, 2018, 05:09:00 pm »
I did read "off" is just putting the Roku to sleep, or the screensaver that display's the time.
Vera 3, 1.7.1030, CT101, Everspring motion sensor, GE/Jasco switch, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, Weatherunderground, LB60Z-1 bulb, Hue, Alexa

Offline blakem

  • Sr. Newbie
  • *
  • Posts: 49
  • Karma: +7/-0
Re: PLUGIN: RokuControl
« Reply #4 on: February 09, 2018, 09:28:28 pm »
I really like the plugin so far.  I know the interface is fairly simple so a plugin is not necessary for simple things, but I like the ability to use the actions in scenes.  I did notice a couple things while using it.  The SetPlayMode action in I_RokuControl1.xml had a copy and paste error where every play control action(fwd,play,rev) triggers a fast forward keypress.

The other oddity is the volume up and down do not seem to change the volume.  I think this is possibly and issue with my device.  I can turn the TV volume up and down with the Roku remote through the HDMI interface, but when doing this with the external API, it does not have the same result.  It could related to the fact that a single keypress on the physical remote only displays the volume level without changing it.  I think the keypress command on the external API will have the same result, but when I used keydown it had the same result.  The mute button works just fine. 

Again thank you for sharing this great plugin.  Hopefully Roku keeps expanding the API in the future.

Thought I would mention you should upload it to the MIOS app store.  I know I would appreciate the live updates.
« Last Edit: February 09, 2018, 09:32:55 pm by blakem »

Offline bdparker

  • Newbie
  • *
  • Posts: 15
  • Karma: +1/-0
Re: PLUGIN: RokuControl
« Reply #5 on: February 09, 2018, 10:25:43 pm »
Thanks for the feedback! What Roku model do you have?
Volume works on my TV, but the Roku doesn't support volume control, so maybe this is an API limitation on some devices.

Offline blakem

  • Sr. Newbie
  • *
  • Posts: 49
  • Karma: +7/-0
Re: PLUGIN: RokuControl
« Reply #6 on: February 09, 2018, 10:32:02 pm »
Thanks for the feedback! What Roku model do you have?
Volume works on my TV, but the Roku doesn't support volume control, so maybe this is an API limitation on some devices.
4200X - Roku 3

It is just a set top box but the remote has volume controls that work through the HDMI input to the TV.  Just apparently not with the external API.

Sent from my A0001 using Tapatalk


Offline statix73

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: PLUGIN: RokuControl
« Reply #7 on: August 19, 2018, 08:11:14 am »
Are there any values or expressions that i can use for SetPlayMode in PLEG?

Offline statix73

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: PLUGIN: RokuControl
« Reply #8 on: August 22, 2018, 06:21:22 am »
Would it be possible at all to separate the play/pause button? as I have a motion sensor that when triggered pauses my roku, but it unfortunately also unpauses it.

Offline shawnky

  • Sr. Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Re: PLUGIN: RokuControl
« Reply #9 on: November 04, 2018, 07:10:29 am »
Nice app! Any way to get more than one Roku working with it?