[RELEASE] Roku Virtual Buttons

smartapp_av
roku
project_voice

(Sam Steele) #1

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: https://github.com/MadMouse/SmartThings/blob/master/RokuManager/RokuConnect.groovy
• My modified Roku device type (until MadMouse merges my change): https://github.com/c99koder/SmartThings/blob/master/devicetypes/madmouse/roku.src/roku.groovy
• Roku virtual buttons SmartApp: https://github.com/c99koder/SmartThings/blob/master/smartapps/c99koder/roku-virtual-buttons.src/roku-virtual-buttons.groovy

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:


New to Smartthings, help needed
Google Home
(Christopher Filip) #2

I get an error when trying tonrun the virtual buttons app


(Sam Steele) #3

What’s the error?


(Jaime Aviles) #4

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.


(Sam Steele) #5

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.


(Jaime Aviles) #6

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.


(Wallace Walcher) #7

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.


(Eric Boehs) #8

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.


(Sam Steele) #9

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


(Halcyon Acres) #10

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


(Sam Steele) #11

Check the error log in the web IDE


(Halcyon Acres) #12

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)


(Sam Steele) #13

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


(Halcyon Acres) #14

I used all the ones linked above.


(Sam Steele) #15

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

command “getAllActivities”


(Halcyon Acres) #16

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.


(Sam Steele) #17

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


(John T Foster) #18

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


(Halcyon Acres) #19

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?)


#20

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?