[OBSOLETE] Roku Virtual Buttons

This SmartApp creates virtual button devices for the apps installed on your Roku device. I’m using this with a Google Home to switch inputs on my TCL Roku TV, for example “OK Google, switch to the xbox” triggers IFTTT to press the “Roku: Game console” button.

Requirements:
• SmartThings “Momentary Button Tile” devicetype (from Templates in the IDE)
• Roku manager SmartApp from MadMouse: SmartThings/RokuConnect.groovy at master · MadMouse/SmartThings · GitHub
• My modified Roku device type (until MadMouse merges my change): SmartThings/roku.groovy at master · c99koder/SmartThings · GitHub
• Roku virtual buttons SmartApp: SmartThings/roku-virtual-buttons.groovy at master · c99koder/SmartThings · GitHub

Instructions:
• Install the requirements above and then launch the “Roku (Connect)” SmartApp to discover and pair your Roku device
• Launch the Roku Virtual Buttons SmartApp and select your Roku device, then tap the Done button

When the settings are saved, the SmartApp will create button devices for each app on your Roku, they should appear in your My Home list with the prefix "Roku: "

Screenshot:

3 Likes

I get an error when trying tonrun the virtual buttons app

1 Like

What’s the error?

Thanks for this magic trick! Works awesome I do have a question and comments once I get to play with this. I have google home and I can’t wait to test this, Have not figured out a way, or the command to turn off the TV via ST. I, would like to turn off the TV by voice command if the remote is not handy or “lost” at the moment.

I use a Logitech Harmony to turn my tv on and off, but it should be possible to add another button tile to turn the TV off via the remote API. It wouldn’t be able to turn the TV on, however, as it disconnects from the WiFi network a few minutes after going into standby mode. I’ll look into adding an “off” button to the list of actions.

Sometimes I use the ROKU app to turn the TV off, but using ST with voice commands would be better. I would try to do it myself but not enough knowhow for now. Need beta tester let me know.

I also get an error. It says, via red error ribbon on the top of the screen, “An unexpected error occurred.” This happens right after I launch the Roku Virtual Buttons SmartApp and select my Roku device, give it a name and then tap the Done button.

I don’t have an amazing solution or lots of documentation here. But I’ve figured out how to turn off and turn on a TCL Roku TV.

Given the TV hasn’t fell asleep, you can power it on by sending a GET request to /keypress/Power. But your TV usually falls asleep. To wake it, you can send a WOL packet to the MAC address.

To turn the TV off, a GET request of /keypress/PowerOff should do.

Here is a Device Type that will only turn the TV on and off. Feel free to combine it with c99koder’s Device Type.

Feedback welcome.

Very cool, I didn’t realize the TV responded to WOL packets! I’ll integrate this with my device type and add power on / off buttons to the smartapp soon

Hi,
I’m getting the unexpected error thing also. Any place to look to see what the actual error is?

Check the error log in the web IDE

I ran it in the simulator, here is what happened:

java.lang.IllegalArgumentException: Command ‘getAllActivities’ is not supported by device 9911e824-c9bc-4ea0-94a1-83073e4b44e7 of type ‘Roku’. Supported commands: [on, off, refresh, startActivity, homeButton, selectButton, previousButton, nextButton, launchAppId, startActivityWithContent, pressKey] @ line 44

I guess my Roku is too old? (Roku 3)

Are you using my Roku device type handler, or a different one?

I used all the ones linked above.

try adding the following on line 39 of Roku.groovy and let me know if it fixes the issue:

command “getAllActivities”

That’s the trick. :smiley:
It’s working now.
I was going to mention that line was missing, but wasn’t sure.

Thanks so much for the prompt support!!
awesome.

Glad that fixed it! I’ve added the missing line to github

Is there a way to support multiple Roku’s? For example, one in living room, one on back porch?

How would I expose the Roku remote buttons as momentary pushbuttons?
(or otherwise call the commands defined in the MadMouse app from, say CoRE or similar?)

Cool. I wanted to see if this will work if I have a Roku 3 as opposed to a Roku TV. Also, I have Sling TV that I watch on my Roku. Is there anyway to create a virtual button so I can go into Sling and watch a particular channel?

1 Like