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

odd behavior - wondering if there is an easy explanation:

When I list devices and sort by Type, Roku TV comes up first - everything else is alphabetized.

Perhaps it is using the repo as part of the name, which for my stuff is apwelsh.

I thought maybe a non-ascii char in the name... ap.... isn't before Ad.... :slight_smile:

no. But apwelsh comes before hubitat. The built-in devices are published with the hubitat repository. Something like: apwelsh/Roku TV and hubitat/Advanced Zigbee CT Bulb


Hey @armand - per a discussion in this thread. I think I confused myself and can't find the answer.
Does this app just poll or do you also get events from the TV in real-ish time?

e.g. I currently have my device preferences set to 10min. But I'm not sure if that limits me getting details about the TV state every 10min, or if this is really just a 'full forced' refresh,

Thanks for any clarification!

1 Like

I double checked my device settings and it's 5 minutes for my Roku sound bar that I use to trigger my lighting scene, but the transport status updates almost instantly.


There is no messaging facility provided roku. The only way to get the data is through polling. Because of this, I use several techniques to get the data. If the TV is off, I can only detect state via a full refresh. If the power is on, and advanced polling is enabled, you can use the other light weight polling intervals to assist with the refresh. For instance, if you poll for current app every 3 seconds, with a full refresh set to every 5 minutes, and you turn the TV on using the remote, it could take up to 5 minutes for the app to know. But if you launch an app channel, within 3 seconds it will know, and show the TV as on.
Also, after every command set by the app, it will know if the TV is on or off, as it will issue a refresh to confirm the results of the event. To save pan processing, they update happens a certain number of milliseconds after the button event so that if you send 5 different button events, it will only update after the last one.

1 Like

Awesome, thank you.
For reference what are the app defaults? I’d like to make sure I’m on the default and tweak from there if possible.

The default have changed over time to adapt to a smoother experience with minimal impact to hub. The current defaults are:

  • Using “simple” refresh controls
  • Full Refresh = 5 minutes

The default is for using just the HE as a remote control.

What I recommend for automations based on remote actions is as a follows:

  • Using “advanced” refresh controls
  • Device Info Refresh = 5 minutes
  • Active App Refresh = 5 seconds
  • Media Player Refresh = 2 seconds
  • Find Installed Apps refresh = 30 minutes
1 Like

This is great, thank you.

On my main Roku device app, I see the "Simple refresh" (which I have toggled off) and the Full refresh setting.
What I'm not seeing is where to tweak (or check) these other 4.

Is that exposed or I look in the code?

Turning the "simple" setting off is what enables the advanced settings. You have to click "save" before you'll see any of the advanced settings appear.

That is correct. It is a limitation in how device drivers work. For apps, they can be updated immediately upon change of selection, but for devices you have to save the settings yo see the new options.

So I'm an idiot. The label through me off. I thought the toggle was for "simple settings" and it was off, so I assumed that meant advanced. It wasn't until I turned what I thought was Simple Settings "on" and saving that I see it changed to tell me that that was what turned Advanced on.

Thank you all!

Yeah, I should fix that. I was trying to keep things simple and failed to account for new users that don’t understand the history of the setting. I have made a lot of changes to how the refreshes work to try and keep the cpu load low. There is no magic pill. If you do a full refresh every 2 seconds, it will work just fine and seem like it is fully and perfectly integrated, but cpu load will be so high you will notice when the hub is working it spends most of its processing on just the roku. So try to be realistic on you timings. A full refresh is a massive XML document download from the roku. The current app is just 3 lines of xml text. So current app refresh is light weight and media state (detecting play/pause state) is even lighter weight. So I also use some basic logic to ensure if an app is loaded that supports play/pause actions, then I don’t perform a full refresh not an app refresh at all. As soon as the app exists, I go back to current app check, but if current app is tiki, then I use the full refresh and only scan for power state w/o xml parsing. Its really confusing.


I tried the more direct approach of using RM to watch for a changed value in Roku TV ► Custom Attribute ► Application, hoping that would work as a simple Trigger. Despite having shortened the Active Application's update interval to 15s, this never seems to fire.

Is that approach invalid? That is, should I stick with the Child device method only?

The primary reason I did not attempt the latter (yet) was simply because I don't see "Sling" as a viable candidate (I've never fully installed this Channel, but it is a built-in button my Roku remote, hence very tempting to use as a button trigger in HE). So, perhaps I should also ask, "Do you have to actually install a particular app like Sling in order for Roku Connect to see it as a potential Child device?"

Sorry for the n00b questions. I honestly did try to cull these answers from the previous 418 responses. :slight_smile:

If you want to trigger an event when the active app changes, set active app to something like 3-5 seconds.

I recommend the attribute mediaInputSource rather than Application, simply because application is a custom attribute, and mediaInputSource is associated with the MediaInputSource standard capability. but any attribute can be used in rules.

Just realize that if the TV is off, and you don't turn it on using Hubitat, it won't perform any refreshes except the power on check until the TV is turned on. Using the child device or using the TV's attributes is a matter of personal choice. The child device does enable more portability, as the child device is a switch device, but it's just a matter of personal choice.

Please share you device info page, and I can provide more valuable feedback.

As for the remote control buttons, I cannot read those buttons at all. The remote controls the TV, and I can sense the changes to the TV's state. Each app button is hard-coded to run the app associated with the button. It does this by send an IR remote code to launch the app (by app ID number). As such, the sling button will launch the sling app on the roku. If it is not installed, it will likely ask you to install the app. Once the app is launched, if the Roku is on, and still has the correct IP address, then once the the roku tv driver detects the roku is not powered off, then it will initiate all the refresh events .

Please share the screen shot, and we can see what recommendations we would make.

1 Like

I had used a very similar Roku plug-in back on the Vera platform, so am quite familiar with how things should work, but seem to have run into an unexpected roadblock. So thanks for the kind offer of assistance. Here's what I have set up:

• Roku Connect and all things installed via HPM;
• App and Child device properly configured;
• Roku TV properly detected and queried;
• All controls (setMediaInputSource, VolumeUp, etc.) work;
• Full logging turned ON and polling lowered to 10s;

Here's where I get stumped:

• Created a rule that looks like this...

• Yet when I hop among various Inputs (HDMI1, HDMI2, etc.) and linger on each for more than 10 seconds, the Hubitat Log never shows those changes, nor does the Rule fire...

Despite all Logging forms turns on in Rule, nothing manifests, and the local variable remain initialized. Guess I am left wondering what I'm missing when it comes to using RokuTV as a Trigger.

Thanks for any insights.

  • Libra

And on the device do you see the attribute value changing for each app/input?

1 Like

Almost a trick question, as when it switches away from HDMI1 I cannot see my PC/browser. I had expected it would, but I'll have to double-check using some other access method, like my smartphone.

Truth be told, this is exactly why I crafted that test rule, was to check whether those values were changing at all. So far, looks like the answer is, "No" but I'll check tomorrow.

Download the Hubitat app