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

It turned out the WebCore has the Raise Volume calling the volumeDown method, and Lower Volume casing the volumeUp method. This is a flaw in WebCore, not my roku code.

Is app:1565 your Roku device, or the Rule?

This is a good start, though as per my prior messages, I suspect this may be an issue in the rule, or in RM. To know, where to start looking, we first need to identify what app:1565 is.

Yeah app:1565 is a rule in RM. What's funny is that now I am not seeing that error anymore. I just tested it again. Still not working. Roku TV shows correct application is running (Netflix at the moment), but my rule in RM is not seeing that.

If I look at the child devices for this Roku device (is that what you call them?), I see that Netflix is listed as a "Generic Component Switch" device type. If I look at the device properties, it says that the switch for Netflix is currently "off." It should be on. That's what my rule in RM looks for as a trigger, so that explains it. So why would the switch be reporting as "off?"

That makes a bit more sense.

First, please make sure you have the latest version of code. I recommend using Hubitat Package Manager if you don’t already.
If your code is out of date, please update and try again.

If you do have the latest version of the code, then proceed with the following:

Please press the refresh button on the roku and see if that changes it. Also, try changing to another app, then changing back using the set input source and typing the name of the app as it appears in the supportedInputs attribute. Of you see it change away and back using the He device, and the child switch does not update on/off state, then please delete and re-add the application child devices.

I was just able to reproduce this. I am completely stumped on why my local version was different from the published version, even though HPM would not update my local version. I will have to figure that one out.... anyways

As soon as I applied the published version, the issue was apparent. I have fixed it, and pushed out the fix.

1 Like

OK so I just pulled down the update in HPM and tested it out. The child device switches are once again reporting properly, so my issue seems to be resolved. Thanks so much!

1 Like

The search function in the parent device required a numeric provider id. I've not been able to find out where to find provider id's.

If you install the app as a child device, it's in the Device Network ID (DNI) of the child app. The app number is the number following the hyphen. It also appears in the URL of the iconPath which is stored in the device's Data section.

How can I use webcore to set the Roku TV to a specific channel?

I don’t use WebCore, so I cannot answer that completely. But the method to set the channel are channelUp and channelDown. There is no setChannel function, because there is no way to do this on a remote control. I do have a roku TV with the channels enabled, so I can look into adding the feature, if it is possible, it will likely require a deep link which is app specific. That shouldn’t be a problem, since the TV app is common for all roku TVs…

1 Like

@armand

If it helps, the harmony hub can send a direct channel command to it, but of course it's logitech software so you can't send a "." or "-" to access HD channels because they have those buttons disabled in the device controls. (Common issue with them on various TV's). But, whole number channels work....so the TV can respond to it, even if the Roku remote can't send it.

I added a new "setChannel" command that accepts a number (decimal numbers are allowed).

The TV must already by on, and the Live TV app must be loaded (InputTuner) otherwise the command will exit silently.

This command is a bit of a hack. There is now way to change channels, but I can send any characters as key presses. Additionally, the Tuner app does not allow enter channel numbers, unless the guide is visible, so, what this does is the following

  1. send key press Left
  2. convert channel to a sequence of characters
    2a) for each character, send key press Lit_{key} there {key} is the number or period
  3. send key press Select.

so, channel 1180, looks like this:
keyPress('Left')
keyPress('Lit_1')
keyPress('Lit_1')
keyPress('Lit_8')
keyPress('Lit_0')
keyPress('Select')

channel 24.1, looks like this:
keyPress('Left')
keyPress('Lit_2')
keyPress('Lit_4')
keyPress('Lit_.')
keyPress('Lit_1')
keyPress('Select')

I do not pause between keypresses, as it appears to work without it, and does not have the look as if the keys are being pressed this way.

Let me know if I need to add a keypress delay.

Armand

Wanted to chime in on a new automation that I'm loving thanks to this integration.

Context: I have very young kids, and they have started to silently exit their room after we put them down. We caught our son sitting silently on the stairwell watching the TV we were watching which isn't age appropriote. We lucked out that for those 5 min nothing truly horrible happened beyond bad language.

Solution:
I installed a contact sensor on their door. I now have a RM rule that when their door opens when we are in "Kids sleep mode" which is 7:30-10:30pm, the downstairs light will slightly turn on then dim back off (like a soft-flash), and if the TV is playing, pauses the show we are watching.

Last night it worked perfectly, caught both our kids at different times tiptoeing out of their rooms to spy on mom and dad.

The WAF was stellar when she saw the auto-pause. Love it.

2 Likes

Bravo!

Here's hoping, though, that you don't watch anything with nudity, and that they don't pick that exact moment to sneak out and pause it. :stuck_out_tongue_winking_eye:

1 Like

I guess you could press pause, then the home button….then when you return to the app, it resumes where it left off.

1 Like

Ha, I did think about that. If that happens I will be quick to hit the home button.

@armand I'm getting an error when using supported inputs as an attribute. Use case is simple, when app is changed (netflix, hulu, etc) it should trigger a scene. During creation of the condition I get the following

Supported inputs is the list if all the inputs. What you want to use is attributes: application or mediaInputSource.

1 Like

Hi

I have a Roku Streaming Stick+. I would like to run automations that activate my cinema lighting scene if something starts playing and prevents some scheduled automations from running, but I'm not sure how to set this as a condition since 'play' doesn't seem to be an option in rule machine?

Any help with this would be greatly appreciated

It would likely be under "Custom Attribute" in Rule Machine. That is where most of the non-standard stuff can be found.

When I do this with my Roku, I do see my devices show up in Custom Attribute, and from there you select which of the ones you want to trigger from.

1 Like