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

I understand the issue, thank you. My point is that there are four different refreshes (instead 2 or 3 from older versions) and a lot less events than before. If your experiencing high loads, consider turning on the advanced refresh mode, and setting the refresh rate to less aggressive values. I set the media transport to 2 seconds, the media input source to 5 seconds, the app inventory to 4 hours, and the device info refresh to 5 minutes.

This works well for me, and keeps the loads very low. Unless I am watching a show. Because the media transport refresh only runs while an application is active.

Thank you for the advice. As a test earlier I removed the 3 Roku devices in my configuration. This is the difference.

The arrow points to when I removed them. I hadn't changed anything with them for months other then simply applying updates from HPM. You can even seen in that graphic when i installed the update that generated the increased load. I have added one device back in with the settings that I think match what you say.

Others should keep an eye on there setup incase they are having load issues. I am glad I only had 3 devices and not many more.

What are your refresh settings? Also, what are you using to measure usage?

I think your advice to flip the switch for refresh controls was what was needed. It isn't clear flipping the switch does though. Before it is flipped it doesn't indicate that is the way to activate the advanced refreah options.

Now they are set as follows

Device refresh 5 min
Active App 5 sec
Media player 2 sec
Find installed apps 59 min.

It doesn't let the adjustment of the Find Installed Apps to be set any higher then that.

With that said it appears it ia running in a far better state now. I will likely adjust the device refresh lower as power state really is my main use.

Thanks you for the quick help.

Oh your right. Sorry. I set it to 5 minutes. Haha as I add new features as requested by my users (and I add every feature I find reasonable), I have to come up with clever ways to perform the queries.
When I first created this I only had two queries. It was easier. Now I have 4 and I am working on a 5th for those that use the tuner. So, I try to keep it efficient as best I can. Unfortunately I am not the best at documentation.

Thank you for making the change and let me know if you find any issues please. I try to address any break fixes immediately and feature enhancements as fast as is doable with my busy day job.

Hey no problem I now how it can be. I had a few apps that i maintained on the ST platform until i transitioned to Hubitat back in November.

As far as your second question from above. The graph is from Grafana with InfluxDB. for that particular Metric it was put in InfluxDB by node red using @thebearmay's Hub information Driver. Which is just polling the new WEB API on the hub with 2.2.6 to get the cpu 5 min load. That is a nifty piece of kit to know how your hub is doing on various resources and such.

So i guess my next question would be is there a way for us to simply turn off these additional refresh/Polling functions. In my case I really just use Power state and don't touch the advanced features so i really just need the main refresh being completed and not the others. Can i just set the others to a pooling rate of 0 and just turn them off?

Let me look to see what I can do, might be able to reconfigure a little to make each a preference that can be unselected at will.

Yes. Setting the refresh to 0 disables it.

Also, power state is the most CPU intensive check. I am looking to implement more intelligence. Such as, when the device is on, poll only the media transport and / or the media input source, since those are the least intensive. But once the current input is “Home” or the current application is “Roku” (the same values really, just different attributes), then I have no way of knowing if the power state is on or off. So, for this, I must check the device state. The device state returns a full page xml document, that the xmlslurper must parse through to compute the power state. This is simply how the ECP protocol works.

You will reduce CPU load, but only marginally. Some things I can do is to cache data, but drivers do not offer any way to create variables that cache data, so such coding efforts only have a performance impact if the code needs to lookup something two or more times per operation.

Actually i wasn't thinking about changes to the Hub Info Driver.

It's not a bad idea though as many of the items are an additional inquiry to the hub, and if you don't need/want that particular piece...

I can't set the refresh interval to 0 as it requires the number to be 1 or higher

Oversight. I just fixed that. Please test it out.

I have tested it out and i am now able to put a 0 in for the interval. That is working.

With that said i have still been experiencing some strangeness with the app. After reviewing the Device history this morning it appeared that I had almost no activity at all on the device in the logs this morning. That would appear to be great except for the fact it wasn't doing any refreshes at all. Upon looking at the device it had no scheduled tasks for the refreshes.

I have decided to take a look at the driver and see if i could figure out the scheduling. I think i may have something and will let you know once i have tested my theory. I remember scheduling jobs could be a pain from ST. I made a few tweaks now and letting it run for a bit to see the results.

Also just to be clear this experience above was being tested on a TLC Roku TV that gets true on/off states. My Roku Sticks on two other TV's would never have seen the same behavior.

I look forward to seeing what you find out. I use all TCL TVs and a Roku player for one older TV. For me, it all works great. But, I cannot test every possible use case.

I updated to HE version 2.2.6.140 tonight. I then ran package manager to update the driver. The device is a TCL Roku TV. I am now getting this error in my logs:

2021-04-27 09:02:43.098 pm [error] java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 19 [0-9]*queryActiveApp) ^ on line 330 (refresh)

I looked at (near) line 330, I don't see any unmatched (

Ok. On it! I just pushed an update for an unrelated issue and I may have accidentally injected some error..

There is. it's inside the quotes. I fixed all three instances of this mistake.

Please pull the update

OK, just waiting for PM to reflect the update. I'll report as soon as I apply. Thanks!

Update applied. No more errors in the logs. Thanks so much for the quick fix.

1 Like

I have made changes to the driver that greatly reduces the cpu load of the driver on the HE hub. I added a configure command that will configure the driver, should you need to update the state with new values. I also found a logic bug that was corrected in how some of the data gets updated.

1 Like