Roku TV device driver

That didn't work for me. I can't get it to register that the TV is off, though I can use the buttons to turn it on and off.

If you have linux or a Mac, you can use the following curl command to see what the TV is reporting for its device-info. Not sure what the windows equivalent would be to make a low level http call.

curl http://IP_address _of_TV:8060/query/device-info

power-mode is the parameter we are interested in. On mine, it shows this when its powered off

Headless

and this when its on

PowerOn

I was looking at the device query responses and indeed Headless does show up eventually. Good catch!

Very interesting. Mine shows DisplayOff.

I --think-- I saw Poweroff immediately after it being turned off, but eventually Headless shows up. Haven't seen DisplayOff. Maybe in the preferences we can enter the proper subtext to search for in msg.body so we don't need multiple versions.

The Windows version is:

curl http://IP_address _of_TV:8060/query/device-info

Windows has had curl, ssh, and a number of other open-source tools for the past couple releases. :slight_smile:

I think that the problem is that when the device go to sleep or off need a WOL wake on lan, the original driver you find do that on line 98 "wake on lan ${deviceMac}", I don't know if hubitat have support the command if they do I could probably change a couple lines to make it work.

Turning the tv on and off from the driver via WOL seems to work fine, this issue was related to detecting if it was on or off.

This worked for me. I suspect it has to do with whether or not the TV supports one of these:

<supports-warm-standby>true</supports-warm-standby>
<supports-suspend>true</supports-suspend>

If this is going to be a robust driver we should probably have a preference for whether the TV is set to fast wake mode or not. Also, we get the MAC addresses back from the status query so we don't necessarily need to ask the user for those. We can populate them first time we perform a status request. That way the user doesn't have to fuss and worry about the way the code wants it formatted either.

Man I wish there was a section where people like me who have absolutely no clue about programming and code could take advantage of things like this.. I also have a TCL (Roku) TV and I would love to add functionality to Google Home using a driver like this.

Perhaps once you guys get it all sorted out, you'd be willing to post up a "how to" for total newbs like me?

I sure would appreciate it !!

@mcneelyworld
Take this driver which has the fix I mentioned.

Google or search the forums about how to install a user provided driver. Use this code to create the driver. Create a virtual device and choose this driver as the type. Once you have the correct type selected there will be two required preferences; IP and MAC. You can Google this as well if you don't know where to find this but those are essentially identifiers for where your TV is found on your network.

Once those are filled in you should be able to control your TV from Hubitat. If you share the device to Google it will only show up as a switch so you would be able to turn it on or off and nothing more. Google's API doesn't provide a type for TVs yet.

https://developers.google.com/actions/smarthome/guides/

We could implement switch level on the driver which would probably allow us to change the volume but then the TV would also get treated as a light switch. I'm not too keen on that. I'd rather create a scene in Hubitat that does all of the heavy lifting (switches input, sets volume, etc.) and then share the scene switch to Google.

1 Like

Works Beautifully! Thanks!

stopped working for me.

I am going to try redo everything from scratch but wondering if anyone else is having problems?

No problems here so far.

This is dated, I know. I had the same issue, and I fixed it in my own version of the device handler that was based on this one. I made other changes so I did not push my changes, I just forked the DTH to make it fit my unique needs. This is not a push to switch to my driver, rather a suggestion that I had the issue as you explain, and it was able to be fixed. As such, maybe the fix you tried to apply just has a typo, or was not quite implemented right.

@mcneelyworld since the codahq link you posted works quite well in my testing, I added it to the Compatible Devices Wiki

That’s cool. Did you try my modified version? You can switch apps and it implements the official capabilities for controlling a TV.

I saw your mention of your driver, but couldn't find what you were referring to. You had only a few posts in this thread and none contained a link.

I eventually stumbled over it later on that evening. As my only goal was to remotely turn off the TV, I put off upgrading :wink: You should add it to the wiki page.

Yes. That is intentional. I based mine off of this one, and have made several changes. I don’t want to take away from this one, just wanted to point out I added some additional capabilities and changed some behavior. So, I created a different thread for mine. I don’t remember the details as to why, but I try to make it clear, that mine is just an extension on the work done here.

I updated the wiki.

@endorphin_junkie Argh... the wiki. Thanks for bringing this up. I should probably do that some time. I haven't ever updated it and I've released quite a few drivers. Documentation is the worst.