|
|
|
The following page was printed from RemoteCentral.com:
Topic: | IP Control of ROKU This thread has 8 replies. Displaying all posts. |
|
Post 1 made on Sunday September 29, 2024 at 01:53 |
mpg7321 Regular Member |
Joined: Posts: | June 2020 145 |
|
|
I am working on IP control of my ROKU, using the example file form the DL section of theses forums, seems to work but a bit glitchy, meaning a command missed from time to time. I am also working on a ramp up script for navigation, mainly for FF or RR through YouTube videos, especially long videos. Don't know if its just an limitation with the Pronto age, when compared to my URC remote, that remote every thing works very smooth, especially the ramp up control. Below is the code I am trying for ramping up, works OK but again not very smooth. Any suggestions would be apricated. Trying to decide if I should just scrap the pronto's and order an TDC-5100 from URC or continue on with what I have.
var steps = '1'; var url = CF.widget("aURL","PARAMETERS").label; var timeout = CF.widget("aTIMEOUT","PARAMETERS").label; var socket = new TCPSocket(true); socket.connect(url, 8060, timeout); socket.write("POST /keypress/Right HTTP/1.1\r\n\r\n"); socket.close();
onHold = function() { var socket = new TCPSocket(true); socket.connect(url, 8060, timeout); if (steps <= 10) { steps++; socket.write("POST /keypress/Right HTTP/1.1\r\n\r\n"); } else if (steps >= 11 && steps <=20) { steps++; socket.write("POST /keypress/Right HTTP/1.1\r\n\r\n"); socket.write("POST /keypress/Right HTTP/1.1\r\n\r\n"); }else{ //steps++; socket.write("POST /keypress/Right HTTP/1.1\r\n\r\n"); socket.write("POST /keypress/Right HTTP/1.1\r\n\r\n"); socket.write("POST /keypress/Right HTTP/1.1\r\n\r\n"); socket.write("POST /keypress/Right HTTP/1.1\r\n\r\n"); } socket.close(); }; onHoldInterval = 150 ;
|
|
Post 2 made on Sunday September 29, 2024 at 04:40 |
Twelfth Monkey Long Time Member |
Joined: Posts: | November 2016 117 |
|
|
Not answering your question I'm afraid - but I did look at the URC stuff. Can the user customise their stuff like you can a Pronto, or does that need the dealer's input. I take it they don't do IR, but need extenders. Looks nice, but I suspect it's not cheap stuff.
|
|
Post 3 made on Sunday September 29, 2024 at 12:58 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 13,060 |
|
|
The solution above is at best a hack at doing HTTP requests back to back.
I doubt that half of your messages are getting to Roku as you are doing socket.write of multiple POST requests on the same socket instance within your onHold function.
If it works, it's because you are not closing the socket anywhere in the code after your multiple socket write calls within the onHold function.
Finally, after you do this for 16 or so times, I suspect it does not work properly because the Pronto will run out of sockets as you have not closed them within the onHold function.
I am not in a position that enables me to to write or debug this code for you. I'm afraid you are on your own for this one.
If you want non-choppy ramps or responses using onHold and the onHoldInterval, you will likely not get the same response as you would with IR commands. That being said, if it works quite well with URC, then move to that platform.
Regards, Lyndel McGee
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
OP | Post 4 made on Sunday September 29, 2024 at 13:26 |
mpg7321 Regular Member |
Joined: Posts: | June 2020 145 |
|
|
On September 29, 2024 at 04:40, Twelfth Monkey said...
Not answering your question I'm afraid - but I did look at the URC stuff. Can the user customise their stuff like you can a Pronto, or does that need the dealer's input. I take it they don't do IR, but need extenders. Looks nice, but I suspect it's not cheap stuff. Dealer only, I am an installer of URc, I just not wanting to give up on my Pronto's, LOL
|
|
OP | Post 5 made on Sunday September 29, 2024 at 13:42 |
mpg7321 Regular Member |
Joined: Posts: | June 2020 145 |
|
|
Lyndel, you where correct as always, it would run for a few seconds before locking up, assuming out of sockets, the following interval of 50 seems to reproduce the OEM remote and works so far for ramp up and ramp down but not so great for navigating menus and so on. Opening and closing sockets, over and over and over, such with an onHold function, at a point would that not cause issues with the remote and or device you are trying to control?
onHold = function() { keypress2("Left"); }; onHoldInterval = 50 ; // msec
using original code of,
function keypress2(key) { var url = CF.widget("aURL","PARAMETERS").label; var timeout = CF.widget("aTIMEOUT","PARAMETERS").label; var socket = new TCPSocket(true); socket.connect(url, 8060, timeout); socket.write("POST /keypress/"+key+" HTTP/1.1\r\n\r\n"); socket.close(); }
|
|
Post 6 made on Monday September 30, 2024 at 18:37 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 13,060 |
|
|
You assume out of sockets? Well, if you used try/catch and log the errors to the diagnostics log, you would have see just that!
With regard to causing issues... It is just the opposite. Your code now cleans up socket resources appropriately and as such the Roku also being an HTTP Server should also NOT have any issues.
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
Post 7 made on Monday September 30, 2024 at 18:43 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 13,060 |
|
|
Just curious as to why you would not use the keydown and keyup APIs vs keypress? This is all documented on the Roku site. [Link: developer.roku.com]On the press of your Pronto Button, you would issue the HTTP POST for keydown and then in your onRelease handler, you would send HTTP POST for keyup That would be a closer approximation to what you expect (smoother ramping that approaches same behavior you would see from IR) and you don't have to mess with the Pronto button onHoldInterval. When all else fails, a little googling provides a ton of information as does the Philips DEV Guide. ;-)
Last edited by Lyndel McGee on September 30, 2024 19:12.
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
OP | Post 8 made on Monday September 30, 2024 at 23:53 |
mpg7321 Regular Member |
Joined: Posts: | June 2020 145 |
|
|
I was just using the file DL from here, that's what he was using. Even with not using any ramp up or down, His code works for a while, then starts to miss steps. I have to start pressing buttons twice, or leave the page and come back and all works for a while, then back to missing commands. Honestly, I have the extender, all I needed IP for is to launch Apps, the rest I might as well use IR.
|
|
Post 9 made on Monday October 7, 2024 at 20:28 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 13,060 |
|
|
You definitely should try the keyDown/keyUp requests as they would make your scenarios quite nice as you won't be using Pronto's onHold() and onHoldInterval.
Here's one thing I'm not sure of but is critically important if you are attempting volume ramps.
The Pronto will allow you to hold a button down for only around 30 seconds.
What I'm not sure of is if the onRelease() will automatically be called when that timeout expires.
It's worth a try using System.print messages to the console and holding a button down for 30 seconds.
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
|
Before you can reply to a message... |
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now. |
Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.
|
|