[Release] Roku Connect integration App and Roku TV Device Handler

Thanks for that explanation. Now, I am beginning to imagine some good uses here for your app. I had not imagined using the Roku remote action as a trigger.

Some people, me eventually too, Use it to control mood lighting. I still use a remote, but I have the convenience of being able to ask Alexa to turn the TV on and off. I don’t expose my child devices to Alexa, as it just gets cumbersome to try and use Alexa for everything. Since I have three, they each have a unique name, and Alexa thinks they are switches, so I cannot put them in rooms with Alexa and just refer to them as TV. I say, “Alexa, turn on master bedroom tv”, or “Alexa, turn in bar tv”. For my bar TV, I have a TV mood light, but it is WiFi based, and the integration is not yet working well enough so I use Alexa with just a few channels exposed. If I say, “Alexa, watch Hulu in the bar” (a voice routine I defined) it will turn on the bar-tv, then turn on bar-tv-hulu, then turn on and set the tv mood light to green. I use red for NetFlix, A different Red for you tube, blue for Vudu.
If I can ever get the mood light to work on HE, then I won’t need Alexa routines, and HE will control the lighting with simple rules triggered by the TV current channel.

1 Like

My favorite automation rule, I created a routine in Alex, “I’m going to bed” which activates the BedTime scene in HE The Scene in HE is defined to turn off every light, and TV (except master bedroom), lock my Kevo lock, set the mode to night mode, and arm HSM to armed home, and turns on my hallway light, makes sure my outdoor lighting is turned on, and set to desired brightness. All of this is done without cloud except the door lock which requires web access since the kevo hub does not have a local API (none that I know of anyways).

2 Likes

I have the Integration setup and everything is working. Thanks so much for the effort. Great App. I can turn my TV on, tell the Roku to launch YouTube.
Is there a way to send a command to play a particular YouTube video through the Roku?

1 Like

Not presently, and when I do add the feature, it will require you know the show information, because of the way Roku works. Each app is called a channel, and in the channel, each show has a special abstract address. There isn’t a single standard for the address so each channel has its own format. So, my initial version will require Rule Machine to call the function with the channel info. I will have to decide how to proceed from there.

1 Like

Any way to hide/remove some of the children apps? I only plan on using a few channels. When I delete them, they just end up re-appearing due to the automatic setup I guess? Thanks

If you dont want it to automatically manage the apps, once they populate, just turn off the auto populate feature and then delete the ones you don’t want. Now it is a static list. To stop it, just turn off the option Labeled “Enable management of Roku installed application” as shown here.

If you leave “Enable automatic management of child devices” turned on, then you can force reload the apps when you want using the reload apps button.

Later, when I create the integration app, I will be able to move the management features over to the integration app, and it will have auto-discovery of the Roku devices.

Been wanting to integrate this for sometime. Finally did and it got it up and running but I am confused on how to get volume up, and volume down as well as power on and power off and on on a dashboard. I know I need virtual switches but how do I set them up? Help would be much appreciated, thanks

On and Off will work if you add the TV/Roku as a switch. The Roku device is already a TV. There is not volume up/down because the amount of work necessary to raise and lower the volume is quite extensive given that you cannot simply set the volume level using setVolume. If you want to create a virtual button controller, you can create one with two buttons, and then use the RuleMachine to create a button device rule where button 1 press calls custom command volumeUp and button 2 press calls custom command volumeDown. Now, the RokuTV device does support the TV and and AudioVolume capabilities, but as far as I am aware, the Habitat has not yet implement any official support for them. Once they do, you should be able to add the TV as an audio device, and have access to on/off/volumeUp/volumeDown, but you still would not have setVolume, because the Roku has no facility to make this possible -- I do keep checking in with them, and I did submit this as a feature request to Roku over a year ago.

It is because I implement the TV and the AudioVolume capabilities that I did not create child devices for volume control, and because the tv device itself support switch, there is no need to create on/off features as a child switch.

thoughts?

[update] I just looked at the dashboard, and they do support volume as a device type, but unfortunately, it uses a slider. So a button controller or virtual switch may be the way to go here. I will play with it a bit and see what I can come up with.

[update2] I forgot to mention, I am working on convert the management of the child devices and device settings into a Roku Integration app which will find all Rokus. The plan for that update is to allow you to create a child device for each of the supported Roku commands. I am in the middle of a remodel on the house, but I plan to finish the updated tools soon.

1 Like

If you use a virtual Botton controller with 2 buttons, and the Rule Machine button controller, this is what my dashboard looks like:

I do not particularly care for Hubitat Dashboards. It is still very juvenile in design. I use SharpTool.io which has some limitations (would require a virtual momentary switch, it won't control buttons), but you can see it has a different look.

1 Like

If someone fails to install the child app, the following message appears... which isn't very informative. This should be easy to try/catch and tell them to install the child driver.

dev:108 2020-03-30 03:26:20.639 am error org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'null' with class 'null' to class 'int'. Try 'java.lang.Integer' instead on line 391 (parseInstalledApps)

There is no longer a child app to install. The updated driver uses the built-in generic component switch driver.

1 Like

https://raw.githubusercontent.com/apwelsh/hubitat/master/roku/device/roku-tv-app.groovy ??

That driver is there from the old driver to not break older drivers that refresh. If you look at the TV source, you should see it now uses the Hubitat generic driver.

def child = addChildDevice("hubitat", "Generic Component Switch", "${netId}", [label: "${label}-${appName}", isComponent: false, name: "${appName}"]

so just remove this child? Ok.

Yes, if I strongly urge you to review the read me

I did read your README, and was confused because it says "two files"

...thus this discussion :wink:

Must not have got merged correctly from repo, or this is the old one. I will take a look.

Fixed

1 Like

I got this setup, the commands are working awesome.
@aaiyar - Any chance you (or anyone) could share what you are triggering on for this device to set the lights when you start watching TV (or a specific app)?

I'm wondering if it's just looking at the device as a switch or if I'm missing anything better.
image