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

I have a quick question, if i press a button on the roku remote does the event show in the app???

No. The API I use is a public interface created by Roku called, ECP or External Remote Protocol.

This protocol allows developers to create remote control apps, which is what I did. This is not a true integration, in that I cannot listen for TV events, so there is no way to know what keys where pressed on the remote.

1 Like

Ok thanks :+1:

Should have read the last couple of posts as that seems to be doing what i want to do when pause is pressed turn some lights on, when play is pressed turn them off, Using a harmony remote.

1 Like

FYI, @ogiewon's Harmony integration can pick up Home Control Buttons.

1 Like

Is anyone else having problems upgrading this from HPM? The Roku TV driver fails, and if I try manually it also fails on line 83.

Metadata Error: Capability 'MediaTransport' not found. on line 83

This requires the lates Hubitat firmware. I will reconsider if using the capability was a good idea, but I expected everyone would be upgrading.

1 Like

Tried installing using the HPM, not sure what is happening. How do I start it? Should there be an APP in my "apps" list? I don't see one but I see it in the "apps code" section. Please note that I'm an HE n00b and this is actually the first "install" with HPM. Saw that you had created a Roku app and as I have several ROKUs this was a no brainer to install.

Thanks for whatever assistance you can provide.

NorbertD

Under Apps, install User apps, and select Roku Connect.

1 Like

Thanks, that makes sense. I always wait for a bit to upgrade. If I don't have an issue, I wait to upgrade, look at all the threads of issues on 226.

Sorry about that. They added support for the capability and I jumped on using it for the play, pause stop feature. I will always prefer a standard interface when available. I should update the minimum firmware version level to a real version.

After the latest update, I tried to mess around with this further, and only one of my three streaming stick + devices was showing up right. I deleted all three and re-added them, but when I do, I no longer see child devices for the apps. Also when I click on the device, I'm getting the following error:

An unexpected error has occurred trying to load the app. Check Logs for more information.

Error: Cannot invoke method sort() on null object

Any Idea what's going on? Thanks

Edit: Also seeing this over and over in the logs: (x'd out my IP, and app 1256 is Roku Connect)
2021-03-29 10:45:09.737 pm errorjava.lang.NullPointerException: Cannot get property 'name' on null object on line 383 (ssdpHandler)

This appears to be a behavior change in Hubitat, or maybe a long standing bug the was never exposed. I make a call to device.getChildDevices() which should return a list of devices. Instead of an empty list, it started returning a null value. I made the list optional, so now the sort() works even on a null list, instead of an empty list.

Apparently, at one time I had a variable called "device" which conflicts with the built-in device reference, so I renamed it to "roku" but left a log message referring to "device". This one was not likely to ever show up in testing, because it only ever gets called when a roku changes IP addresses. It is recommended to always use static IP addresses, or DHCP reservations for Roku devices (this is a router config) to ensure there is never a break in communications. With a dynamic IP address the integration will still work, but there could be up to a 5 minute period where the device is unreachable. This is because the SSDP discovery only runs every 5 minutes in my driver, when not actively trying to find and add a new device. The auto-detection of IP address changes can only occur when the SSDP discovery runs.
It is up to you if you want to leave the Roku w/o a permanent IP address, but I recommend learning how to setup a DHCP reservation to ensure the Roku is always on an unchanging address.

Thanks for reporting. These were important bugs to squash.

btw,

This is expected. The device are component devices that belong to the Roku Connect app. And the Channel, and button device are component devices that can only exist if the parent Roku device exists. So, if you delete a TV device, all child device are deleted. This is normal for Hubitat.

1 Like

Thanks for the detailed reply. I did figure out children components. I'll also add reservations for the three Rokus.

As far as writing rules for the Roku's I'm assuming it would be using custom attributes. I'm trying to do this with the app "Event Engine", and I can choose a Roku, an attribute (Using TransportStatus), but in Event Engine, it makes you set two custom attributes. I was expecting to only use one "paused" for example.
Does anyone use EE for rules, or should I just use Rule Machine? Not a fan of RM....

Edit: In RM, I can just choose paused from the list and it is working. Right now slowly when from a remote, I'll keep looking just getting started.

Thanks

1 Like

This appears to be a limitation in Event Engine's Cogs. I installed the app to check it out, and what I see if you need to define the on or off states with value 1 and value 2. So I defined it as playing and paused. I think this is a limitation, since this is a tri-state attribute, and they only support two states.

1 Like

Thanks, great work on this. I'm floored that we have the ability to do Roku based automations. Much appreciated!

I recently installed the new Roku skill on my Alexa devices. If you are trying to use Roku with Alexa, the new skill provides a much better interface overall than is possible with the HE Amazon Echo Skill. The reason is that the Roku devices appear as switches to Alexa, so the controls are very limited. With the new Roku skill, you have to refer to you roku as "Roku", but you can associate each one to a specific echo device, so from each room you can say things like, "Alexa, watch Hulu on Roku" and it will turn on your Roku TV, and launch the Hulu app.

When coupled with my updated Roku TV drivers, you can check for current application, or play/pause state with more aggressive schedules (I have defaults built into the app for 2 seconds for media info, and 5 seconds for current application check. So integrations will still trigger while using lightweight API calls to keep the system load rather low in comparison to what was being implemented before.

The current roku code does require HE 2.2.6 to be installed. She the top post for details of what changed.

1 Like

I am just wondering if it is just me, but it looks like the Roku devices are a much larger part of my device activity as of late. My 3 Roku's are the top 3 devices in my Device stats, and by a huge margin.

When I say a huge margin i mean they are over 90% of the busy time for all of my devices.

It can be. It all depends on your refresh interval. If you refresh a lot, you have a lot of activity. This is true for any device that requires a refresh for state updates.

My point is that it appears this has increased dramatically in recent times. I dont remeber it being this heavy previously.