Roku rules

My house is currently a fire tv house. I am looking to move to Roku after seeing the integration. (Community driver)

So I want to know what all is possible. I know I can launch apps but can I start shows from within those apps? (Can I launch PBS kids and play Daniel Tiger in the morning for my 3 year old)

What info can I get back from the roku and what can I send to it?

Anyone have any screenshots of rules they want to share?

Not that I am aware of. At least I haven't seen this as I don't believe Roku exposes the content of the apps through their APIs.

You can see the commands available from the Roku APIs today here: https://developer.roku.com/docs/developer-program/debugging/external-control-api.md

Specifically the General ECP commands.

The [Release] Roku Connect integration App and Roku TV Device Handler - #234 by armand chat group is a good place to ask specifics if you need them, but here's a screenshot of the commands available straight on the device driver for;

Roku Main

The "Key Press" menu has basically all the actions on the remotes if not more.

Individual app

1 Like

Technically, it can be done, but it impractical from an automation perspective. Each show/episode has a unique content ID, and the content ID for the same show differs between Roku apps as does the syntax to request the content. Hulu would use a different Content ID than DirecTV, Sling TV, YouTube TV, etc. And there is no central catalog / lookup service to query each app for the content ID. The best option for this type of Functionality is the FireTV, because it integrates with Amazon's content aggregator, to know how to pass the necessary data to each supported media type.

Frankly, I think the best solution is the one you already have, and using Alexa Automations / Routines to assist with the Hubitat integrations.

1 Like

We don’t use Alexa in my house and there is no way to control the fire tv from Hubitat.

I'm pretty sure you don't actually need an Alexa and can just use the Alexa app to setup routines with virtual devices you expose from HE to perhaps achieve what @armand is suggesting.

I'm doing that to interface parts of my Ring Alarm and Alexa Guard to and from HE without any actual Alexa devices.

Yes but to get any Alexa integration would require cloud connectivity back into the hub. I like that I can query the Roku locally and it will go to the cloud as opposed to allowing it into the hubitat. I might be able to use the Roku integration and some of the HTTP Get/Posts from RM to achieve what I want.

1 Like

Node-red has a remote flow for Roku as well Roku Remote (flow) - Node-RED

My custom code was created specifically to avoid the cloud. I want my home to work even if the internet is out. But even with the cloud in play, you would need to know the show specifically. Meaning, if you only want to open a specific show, and that is it, then I can add this ability. I just couldn't come up with a good use case that would justify working on this effort. Most people want to do "Alex, watch game of thrones" (Google, hey Siri, etc) which won't work since there is not way to convert watch game of thrones into a content ID for an app. But, if your desire is something like: turn on tv, launch Hulu, watch KABC, then I can do this. And I would wonder if it is possible to query the guide from these apps... I will look into it, if this is the use case. Then you could create a child device for "watch ABC on Hulu" or something similar...

My use case would be turn on tv, open pbs kids app and play an episode of Daniel tiger. (I can pull a list of IDs manually and inject one of 10 or so episodes) or possibly launch the Disney app and play an episode of another show or a movie.

Basically something for the kid to watch while she eats breakfast. Maybe later I will but a remote with big buttons with pictures of her top 10 movies and she can start them at will

Even the ability to pull a channel in Hulu would be great. I haven’t even opened the box on my roku so I wouldn’t rush into any implementations just yet

This will work with some tweaks on my end then. Give me a few days to test the solution. Currently, it can turn on the TV and launch the App in one step (by creating a child app for PBS Kids) but it doesn't tune to the content. That is the tricky part I need to tinker with.

1 Like

I was wrong. For Roku, there is a search provide, so I can search by keywords, and I can auto-launch the best match for the selected content type, and even isolate the search to a single app..

I am working on this now.

[update] I have figure out the logistics. For the alpha-release I will offer a custom command you can call to perform your search from RM. Later I will add to the Roku Integration application the ability to add child devices that perform a pre-defined search, and try to launch the content if possible for the associated provider.

2 Likes

You can make a call to custom command from a rule. For your particular case, call:
search("Daniel Tiger's neighborhood Daniel finds something to do", "tv-show", 23333)
Here is the search on my Guest Room Roku.

And here is what it looks like in a RM rule: Note, I did not define triggers for this example

To create the custom action (search):
Select Action Type to Add: Set Mode, Variables or File, Run Custom Action
Select Which Action: Run Custom Action
Select capability of action device: Switch
Select Switches to acton on: Guest Room TV
Select custom command: search
Parameter Type: string
String Value: Daniel tiger's neighborhood Daniel finds something to do
Paramter Type: string
String Value: tv-show
Parameter Type: number
Integer Value: 23333

Then click Done with this action button.

The number 23333 is the application's provider ID, which you can get from the Roku child device for the channel. It is published as the Device Network ID (eg: B0EE7B77C4D9-23333). The number after the hyphen is the provider ID number.

2 Likes

Since there are only a few episodes, for now, you could create a variable in RM, assign that variable a random number, and in your rule, tune to the show (via search) based on the random number.

Example, create a new rule, and in the rule, create a local variable called episode of type Number and initial value 1. Then create an action as follows to set it to a random value

Then use Conditional Actions to translate the selected number to a search phrase. The RM rule will look something like this:

Now to put aside these childish things, and move on to random selecting music video playlists from YouTube for my Bar TV. :slight_smile:

1 Like

That would mean I could put in all of her shows from all of her providers and have a watch random show button!

I really just want to automate the mornings as I am mostly half asleep on autopilot and finding a show to play is the last thing I wanna do!

I was thinking of the mornings. So that she does not have to watch the same episode every morning. This way, each morning she would see a random episode of the show. My next update will be to the Roku Connect app to allow you to create a child device for the search, so you could turn on the switch to initiate the search.

This is amazing. I need this for Tuesday mornings where both me and my wife are busy with work and the kids have 1 hour to watch a show we select..... Woah. Mind Blown :exploding_head:

Any idea if this works for YouTube? Doesn't seem to work for me.