Roku plugin with a TCL Roku TV?

Posted on
Sun Jan 01, 2017 7:20 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Roku plugin with a TCL Roku TV?

Anyone tried this plugin with a Roku TV?

Bill
My Plugin: My People

Posted on
Sun Jan 01, 2017 10:19 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Roku plugin with a TCL Roku TV?

Anyone tried this plugin with a Roku TV?

I have not personally tried it with a Roku TV, but the external control document (from Roku) that I used in making the plugin commands had references to Roku TV (specifically had information about reading and setting channel), so I would guess that it would work. It would be better to hear from someone who owned it, of course...

Posted on
Tue Jan 17, 2017 12:23 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Roku plugin with a TCL Roku TV?

So far, mixed results.

The plugin didn't discover the TCL Roku TV.
I assigned an IP address to the TV then added it to the plugin that way.

So far, all the "Send button-pressed command..." actions work and the response is next to immediate (no noticeable delay)

I haven't messed with "Send a string of text" yet.

The last three: Launch a channel/application, search a channel, and download do not work for me.

Somewhere there is a break in communication between the plugin and the TV. I'm guessing that is the difference between a TV and a set top box.

I would love button presses for the "Power" button (to turn the TV on/off), and volume buttons (up, down, mute)

From the "Send Arbitrary Command" thingie, I can send the command: /keypress/Power and that turns the TV on and off. Pretty cool, but it would be great in a control page or add to my list of Alexa commands.

Jan 17, 2017, 12:17:14 PM
Roku Network Remote Plugin DebugIP address requested for Roku Device: 10.0.6.21
Roku Network Remote Plugin DebugSending /query/apps request to 10.0.6.21
Roku Network Remote Plugin ErrorError in plugin execution:

Traceback (most recent call last):
File "/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/Roku Network Remote.indigoPlugin/Contents/Server Plugin/rokuNetworkRemoteDevice.py", line 204, in retrieveAppList
self.hostPlugin.logger.threaddebug(u'App list response: ' + RPFramework.RPFrameworkUtils.to_unicode(responseStatus) + u'; body: ' + bodyText)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 249: ordinal not in range(128)

Roku Network Remote Plugin DebugIP address requested for Roku Device: 10.0.6.21
Roku Network Remote Plugin DebugSending /query/apps request to 10.0.6.21
Roku Network Remote Plugin ErrorError in plugin execution:

Traceback (most recent call last):
File "/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/Roku Network Remote.indigoPlugin/Contents/Server Plugin/rokuNetworkRemoteDevice.py", line 204, in retrieveAppList
self.hostPlugin.logger.threaddebug(u'App list response: ' + RPFramework.RPFrameworkUtils.to_unicode(responseStatus) + u'; body: ' + bodyText)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 249: ordinal not in range(128)

Roku Network Remote Plugin Threaddebug Call to validate action: launchChannel
Roku Network Remote Plugin Threaddebug Managed validation failed: UiValuesDict : (dict)
lblInstructions : (string)
rokuAppId : (string)Item : (dict)
rokuAppId : Please select the channel/application to search (string)

Bill
My Plugin: My People

Posted on
Tue Jan 17, 2017 11:44 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Roku plugin with a TCL Roku TV?

I can easily add the Power command. If you can confirm via the Send Arbitrary Command the key presses for the volume controls I can add those as well.

The other issue is probably not a TV/Roku difference but rather that the TV apparently isn't sending back straight ASCII text; but the plugin was designed to handle it... clearly a bug. I'm assuming the logger can take unicode, so I can adjust the code to be sure we are explicitly, rather than implicitly, using unicode and can handle special characters. I'll adjust that and add your keypresses once you confirm and get you a version to try out.

Posted on
Wed Jan 18, 2017 8:23 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Roku plugin with a TCL Roku TV?

Additional functions I have found via the arbitrary thing. (Testing really pissed off the 2 year old that is home from daycare today)

/keypress/VolumeUp
/keypress/VolumeDown
/keypress/VolumeMute (Toggles Mute button... couldn't find separate Mute / Un-Mute)

/keypress/PowerOn (Turn on only if off)
/keypress/PowerOff (Turn off only if on)
/keypress/Power (Toggles on/off of TV)

In addition to adding the above, could you add a "Send arbitrary keypress" action (a catch all for any other commands that may be found without having to do a new plugin version)

I couldn't figure out any arbitrary commands to start an application (PLEX, Camera, Netflix, Amazon, etc.)

Bill
My Plugin: My People

Posted on
Wed Jan 18, 2017 8:55 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Roku plugin with a TCL Roku TV?

Found some more stuff / keypresses for a Roku TV:

Some Roku devices, such as Roku TVs, also support: https://sdkdocs.roku.com/display/sdkdoc/External+Control+Guide

VolumeDown
VolumeMute
VolumeUp
PowerOff (As I mentioned above, it also supports PowerOn and Power)

Roku TV devices also support changing the channel when watching the TV tuner input:
ChannelUp
ChannelDown

Roku TV devices also support keys to set the current TV input UI:
InputTuner
InputHDMI1
InputHDMI2
InputHDMI3
InputHDMI4
InputAV1

I looked at PLEX and couldn't find anything for deep linking with Roku. Any experience with this? If no, I can probably tackle that by using the latest PLEX Manger plugin which can push content to a device.

The goals: Automate content:
"Alexa, Turn On Curious George" -> Alexa fires off a action script that turns on the tv, starts PLEX, plays the "Curious George" Playlist. Then I'll keep adding favorites to the available actions for Alexa to control. "Alexa, Turn On Walking Dead", etc...

Perhaps (because I didn't know this app existed on a ROKU until yesterday).... automate IP Cameras.... Doorbell launches Camera app <app id="52937"> with a deep link to the quad view, delay, return to previous content. (A little more complex because it would have to capture what was currently playing and save that info to deep link back to it after showing the camera image for xx seconds.)

FYI.... Pretty awesome TV. The 65" 4K is a little pricy, but the 55" is under $500 at Walmart.

Bill
My Plugin: My People

Posted on
Thu Jan 19, 2017 8:41 am
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Roku plugin with a TCL Roku TV?

I looked at PLEX and couldn't find anything for deep linking with Roku. Any experience with this? If no, I can probably tackle that by using the latest PLEX Manger plugin which can push content to a device.

Last I looked, which admittedly was quite a few months ago, the Plex Roku channel did not support deep linking of content. That was from a Plex developer in their forums, so at least as of that time I would take it as correct.

I hopefully can get a new version out this evening with the changes to the remote buttons as well as (hopefully) getting the apps list, and thus launcher, to work for you. Technically, you can script any action in the plugin, including sending of arbitrary commands and channel changes/commands. I'll get an example for you for that as well.

Adam

Posted on
Thu Jan 19, 2017 9:55 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Roku plugin with a TCL Roku TV?

I was probably reading the same PLEX comments about deep linking... its unfortunate, but I can probably work around it using your other plugin… Not sure, I haven't messed with it yet. Thanks for all your help.... if you find yourself in Houston or next time inm in Baton Rogue, I owe you a few beers. :-)

Bill
My Plugin: My People

Posted on
Thu Jan 19, 2017 10:15 am
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Roku plugin with a TCL Roku TV?

I was probably reading the same PLEX comments about deep linking... its unfortunate, but I can probably work around it using your other plugin… Not sure, I haven't messed with it yet. Thanks for all your help.... if you find yourself in Houston or next time inm in Baton Rogue, I owe you a few beers.

I don't know that Plex can control Roku's content -- I haven't had much luck with pushing stuff out and controlling the Plex channel other than the very basics (play/pause/etc.) I do have the connections made on my devices, though, so I will give that a quick test and see if I can direct it to play a specific media and/or playlist. I would almost promise that the Plex channel would have to be up on the Roku for it to work (if it will at all), but then again if the Launch Channel action works after these changes you could launch Plex, delay a few seconds then send the command.

Posted on
Fri Jan 20, 2017 3:23 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Roku plugin with a TCL Roku TV?

Whenever you get a moment, give this version of the plugin a try and see how it goes with both the new commands and the Launch Channel/App command. If the action to launch channel still bails, please turn on debug, try the dialog, and send me the relevant log info.

Obviously I can't test this without a Roku TV so hoping it all goes well!

Adam

Posted on
Fri Jan 20, 2017 6:53 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Roku plugin with a TCL Roku TV?

Works perfectly!
Downloaded images, shows all the channels, cans go strait to channels, switch inputs, adjust volume and power on / off.
Now to start incorporating it into stuff.

Thank you many times over.

Bill

Bill
My Plugin: My People

Posted on
Thu Jul 06, 2017 9:27 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Roku plugin with a TCL Roku TV?

Do ROKU devices fall asleep?

The Roku TV will totally power down after a few minutes.... So a command to "Turn on" will only work if the TV was just turned off a few minutes ago. Trying to figure out a way to wake it up then tell it to turn on. I was all over settings on the TV looking for a WOL feature... but couldn't find anything and that's something I don't have experience with. Any ideas?

Bill
My Plugin: My People

Posted on
Thu Jul 06, 2017 9:39 am
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Roku plugin with a TCL Roku TV?

First off, I would suggest just giving a standard WOL "Magic Packet" a try and see if it supports it even if not documented... here is the code I use to send in other plugins and this would be easy enough to integrate if it works for you:

Code: Select all
#/////////////////////////////////////////////////////////////////////////////////////////
# Python imports
#/////////////////////////////////////////////////////////////////////////////////////////
import socket
import struct

#/////////////////////////////////////////////////////////////////////////////////////////
#/////////////////////////////////////////////////////////////////////////////////////////
# sendWakeOnLAN
#   Module-level function that executes a WOL request to the given MAC address
#/////////////////////////////////////////////////////////////////////////////////////////
#/////////////////////////////////////////////////////////////////////////////////////////
def sendWakeOnLAN(macaddress):
    # Check macaddress format and try to compensate.
    if len(macaddress) == 12:
        pass
    elif len(macaddress) == 12 + 5:
        sep = macaddress[2]
        macaddress = macaddress.replace(sep, '')
    else:
        raise ValueError(u'Incorrect MAC address format')
 
    # Pad the synchronization stream.
    data = ''.join(['FFFFFFFFFFFF', macaddress * 20])
    send_data = ''

    # Split up the hex values and pack.
    for i in range(0, len(data), 2):
        send_data = ''.join([send_data, struct.pack('B', int(data[i: i + 2], 16))])

    # Broadcast it to the LAN.
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
    sock.sendto(send_data, ('<broadcast>', 7))


You can copy that to a file, then add a Main routine to execute it -- but you will need the MAC address of the Roku TV -- guessing that can be found in the Network Info somewhere:

Code: Select all
if __name__ == '__main__':
    sendWakeOnLAN("[REPLACE WITH YOUR MAC ADDRESS]")

Posted on
Wed Nov 29, 2017 5:56 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Roku plugin with a TCL Roku TV?

I think I used the code correctly?

I changed
Code: Select all
data = ''.join(['FFFFFFFFFFFF', macaddress * 20])
to
Code: Select all
data = ''.join(['94:e9:79:1c:e9:46', macaddress * 20])


but nothing happened. Did I mess that up? I'm a total zero with Python.

Using the "Online Sensor" Plugin, I added a device for the Roku TV to tell me if the TV is on or off. It sorta works.... it tells me if the network adapter is on or off, but not the TV. (I configured the device to ping the Roku TV network address... 10.0.6.21 on my network.)

My thought process...... The smaller Roku TV (32") is now only $135. I would like to be able to use one for the kids but want to get a notification if the TV is turned on in the middle of the night, while they are grounded, etc. I thought about using a iMeterSolo inline with whatever shouldn't be used when they are grounded/sleeping/doing homework/etc. But Insteon stopped making them. Then I remembered that my living room Roku TV is part of my indigo setup.

Sooooo.... I'm still trying to figure out how to wake up the TV after the network adapter falls asleep and now I'm looking to see if I can poll the TV somehow to determine if it is On or Off. Any ideas?

FYI, I'm loving the Roku TV. One of my favorite features is the live preview of the input channels and that it turns on as a smart TV instead of a regular TV that has to load it's smart TV interface.

Bill
My Plugin: My People

Posted on
Wed Nov 29, 2017 11:10 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Roku plugin with a TCL Roku TV?

but nothing happened. Did I mess that up? I'm a total zero with Python.

That isn't what you wanted to do... you need to call that function. Is this in an embedded action? If so, try this:

Code: Select all
#/////////////////////////////////////////////////////////////////////////////////////////
# Python imports
#/////////////////////////////////////////////////////////////////////////////////////////
import socket
import struct

#/////////////////////////////////////////////////////////////////////////////////////////
#/////////////////////////////////////////////////////////////////////////////////////////
# sendWakeOnLAN
#   Module-level function that executes a WOL request to the given MAC address
#/////////////////////////////////////////////////////////////////////////////////////////
#/////////////////////////////////////////////////////////////////////////////////////////
def sendWakeOnLAN(macaddress):
    # Check macaddress format and try to compensate.
    if len(macaddress) == 12:
        pass
    elif len(macaddress) == 12 + 5:
        sep = macaddress[2]
        macaddress = macaddress.replace(sep, '')
    else:
        raise ValueError(u'Incorrect MAC address format')
 
    # Pad the synchronization stream.
    data = ''.join(['FFFFFFFFFFFF', macaddress * 20])
    send_data = ''

    # Split up the hex values and pack.
    for i in range(0, len(data), 2):
        send_data = ''.join([send_data, struct.pack('B', int(data[i: i + 2], 16))])

    # Broadcast it to the LAN.
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
    sock.sendto(send_data, ('<broadcast>', 7))

sendWakeOnLAN("94:e9:79:1c:e9:46")


now I'm looking to see if I can poll the TV somehow to determine if it is On or Off. Any ideas?

Try pinging the television... maybe it will respond if it is On but time out if the adapter, and thus presumably the TV, is Off.

Who is online

Users browsing this forum: No registered users and 2 guests