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

I have the Roku Premier, and two TCL Roku TVs. They all are more than capable of 1 second refresh for everything. The issue won’t be the Roku device. The issue is the Hubitat. How important are frequent updates as compared to your SmartHome responsiveness.
I have my status refresh set to 1 minute, and my current app refresh set to 5 seconds.

I created a simple lighting rule to turn on and off a light when the Hulu app is running or not. If I use the Hubitat, this is nearly instant and the light turns on/off naturally. If I use the Roku remote to launch the Hulu app, and exit back to the main screen, then the light responds quickly enough that it is not awkward, but not as fast as if commanded by the Hubitat.
I think this is a rather natural feel.
If you are not automating stuff to react to TV events, then leave the refresh at the system defaults. The only downside will be that it may not show the correct status right away if you use the Roku remote.

What am I doing wrong? I get an error on line 22 when trying to import the Device app into the app section of hubitat!

What am I doing wrong? I get an error on line 22 when trying to import the Device app into the app section of hubit

This is not an app. This is a driver. Add this into the Drivers Code section. Make sure you add both drivers. I do plan to create an app to search for and install the TVs for you. Until then, this is the correct place to add the code.

Thanks I finally got it working. With it being named app I was trying to use it as such. Appreciate the help this is cool thanks for all the work and effort!

Let me know if you have any requests for changes. I am not in the code very often, but when I am, I like to make changes that people will actually use.

Thank you so much. This is awesome. I really appreciate the support!

I personally scored a lot of WAF with this driver. Quite the happy user. I have it turning my two lamp Sengled color bulbs on and off whenever she switches to Hulu, Netflix, or CBS All Access (she has to watch her soaps lol). Then off again after she hits the home button. And they dim the kitchen lights to 20 at the same time then back 100 when she goes to home.

1 Like

Glad to hear it. This is why I modified my implementation so much from my original version. As soon as I can get my SmartLife LED strip working in Hubitat, I will be doing the same thing. Turning in the TV ambient lighting, and setting the color based on the app being used.

2 Likes

Sorry to resurrect an older thread but I just recently got into hubitat and I'm trying to use this driver. I've got it installed and everything seems to function correctly in terms of controlling my TCL Roku TV from the device page in hubitat. The issue I'm having however is that there is a noticeable delay in the device reporting between on and off when I'm using the physical TV remote. Essentially I've created a simple rule which dims a light down when the TV is turned on and back to 100 when it is turned off and when I use the remote to turn the TV on and off, I get anywhere from 1 minute - 2min delay in the lighting effect. I've messed with the refresh settings however that doesn't seem to help in this regard. Any fixes for when using the actual remote to alleviate the delay?

The driver polls the TV only every couple minutes. The TV can't tell HE when its turned off. I ended up using a zigbee outlet and using the power in my rules for TV going on and off.

Hi Jason - welcome to Hubitat!

@jon1 is correct. The Roku TV can't tell HE when it's turned off, and the driver by default polls every minute (based on memory).

But there's a simple workaround using Rule Machine. You can create rule a where the Roku TV is polled every xyz seconds; other rules that are dependent on the on/off status of the Roku TV will be triggered as soon as a status change is detected. While you can set the polling to occur as often as every second, I wouldn't recommend it.

Here's an example of a rule that polls a Roku TV every 15 seconds:

46%20PM

I use the other Roku driver that does async polling. And I poll @ 15s on 3 TV's.

Could you link to this driver? I tried searching the community for it, but couldn't find it easily.

Thanks!

2 Likes

Thanks, I had seen it, and forgotten to make myself a note to update the driver. Appreciate your re-linking it here.

@jason.motwani - if you decide to use a rule to poll your TVs frequently, you should definitely use the version recommended by @JasonJoel

There is no need to use rule machine. This allow you to poll the TV for status changes every 5 seconds. I have mine set to this value.
I will implement the async calls as well, but I have not, because I do not see any performance issues at all, and I use this driver on 3 Roku devices, and they are all quick.

Seems to me you are either using an older version, or did not actually look into the various settings available — maybe I am misunderstanding the issue with the refresh?

2 Likes

The reason asynchronous calls are preferred is less to do with the performance of your particular app and more to do with the performance hit to the hub itself. Many apps that do not use asynchronous calls have been known to cause hub slowdowns over time. It's just a best practice for Hubitat apps in general.

Yes, that is understand. I am a professional developer, and when I first setup my version, the async had just come out and I was not aware of it. I just have not revisited this since.

2 Likes

For the record I never had issues using your version either. It worked great for me.

In general, I just assume/believe async calls are potentially less impactive on the hub load when there are communication issues. When the network is behaving correctly, and the end devices are alive, I'm not sure how much difference there really is on hub load - probably minimal.

Using a much older version.