Page 1 of 1

fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 3:36 pm
by Snelvuur
So, does anybody made some javascript snippet for the pronto so that you can directly trigger a signal on the irtrans? So instead of using homeseer for instance (saves a few miliseconds) since my zapping experience with homeseer in between just isn't fast enough..

p.s. yes strange topic, i got the dreadfull "your topic is too similar, i could not submit... \o/

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 3:43 pm
by Digit
Eric,

No results yet with your search? Maybe I can help you out, if there's no alternative.
But I'll have to do this on an evening when I'm home alone, cause otherwise I would make everybody crazy here (except myself :D )

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 3:51 pm
by Snelvuur
Hmm no, i tried a post on irtrans and asked around but so far no luck. I mean all the codes are stored in the irtrans database through homeseer i believe so i dont have to enter them again. Because i was almost finished with the complete rework of the pronto interface and then i thought, if i use irtrans i dont have to aim :-) but since we still use the pronto in the living room (still much better then a ipad since you have hard buttons) i could just as well control the lights and such with it.

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 3:58 pm
by Digit
OK.

Guess what, the IRTrans is free tonight :)

Do you have any idea how HS controls the IRTrans? In my case I have a IRTranstray app running which I can send commands like:
Asnd upc,channelup
which means that the code that's stored in a upc.rem file somewhere, is sent to the IRTrans box by the tray app. Result: the upc box goes to the next channel.

Do you recognize this?

In that case, I think that I can get it running in let's say an hour or so.

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 4:13 pm
by Snelvuur
I think that works the same yes.. its i believe this one http://www.irtrans.de/download/Docs/IRT ... ace_EN.pdf

Asnd <remote>,<command>,[l<led>],[b<bus>],[m<mask>]
Asndr <remote>,<command>,[l<led>],[b<bus>],[m<mask>]

and similar, if its going to be tcp/ip i can always open up that port for you..

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 4:19 pm
by Digit
Well let's give it a try then :)
I'll have to wait till the kids are gone upstairs though ...

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 4:37 pm
by Snelvuur
I still have 6 months to go, and then i face the same.. :-)

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 7:56 pm
by Alexander
Congratz! (or did i misunderstood you?)

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 8:16 pm
by Digit
Eric, my congratulations!

I created a xcf with 1 activity that has this activity script:
Code: Select all
function TCPSend(dvc,cmd)
{
  var socket = new TCPSocket(false);
  var result = "";

  socket.onConnect = function()
  {
    System.print("Connected.");
    var str = "";
    str = "ASCIAsnd "+dvc+","+cmd+"\r";
    System.print(str);
    socket.write(str);
  };

  socket.onData = function()
  {
    result = socket.read(5000,1000);
  };

  socket.onIOError = function(e)
  {
    System.print("IO Error.");
  };


if(socket.connected == false)
{
  socket.connect('xx.xx.xx.xx', 21000, 3000);
}

socket.Free;

};

It's quick&dirty, but it works. All you have to do is change the xx.xx.xx.xx to the IP address where the IRTransTray tool is running. Port 21000 is the standard (registered) IRTrans port.

I also added Prontoscript to 2 Hard Buttons (CH+, CH-). Code for CH+ button:
Code: Select all
TCPSend("upc","channelup");

Here you have to change "upc" to whatever device you want to control (check your rem files) and change "channelup" to the command you want to be sent. I will send you the XCF file I used for testing. You can remove all the System.print statements when you've got it working, they were only meant for the debug panel. And remember to change the Wifi settings to yours.

Have fun :)

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 9:10 pm
by Snelvuur
Alexander: no you are correct, i will be daddy :) so i am actually trying to finish stuff now, because then i dont have the time for it (well you still can but you rather not do it then)

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Mar 28, 2011 11:09 pm
by Snelvuur
First test do give me a massive increase of zapping. Its almost as if i have the normal remote. I could not get this through homeseer in between. Only problem now is that after a certain amount of zapping , the irtrans tray client refuses to work anymore. I have top stop/start it and then its ok again (yes i also turned of firewall just in case but no difference)

Re: fietspomp javascript pronto irtrans vliegtuig

PostPosted: Mon Apr 04, 2011 11:33 pm
by Snelvuur
And we have a winner:

This one also closes the statements ad closes the calls correctly, so all bugs are out of this one. Tested it like a million times by pressing buttons and it was still going strong.

Code: Select all
var IPAddress="192.168.1.50";
var Port="21000";
var Timeout="20";
var str = "";
var receivedText = "";

function reInitSocket()
{
   socket = new TCPSocket();
   socket.onConnect = onConnect;
   socket.onData = onData;
   socket.onClose = onClose;
   socket.onIOError = onIOError;
   socket.connect(IPAddress, Port, Timeout);
}

function onTimeout()
{
   reInitSocket();
}

function onConnect(){
   System.print("Connected.");
   if ( socket ) {  socket.write( str ); }
   else {System.print("onConnect: No Socket"); }
}

function onData(){
   System.print("Ondata.");
        receivedText = socket.read(5000,1000);
   socket.close();
   socket = null;
}
             
function onClose(){
   System.print("onClose Event: Socket closed by IRtrans");
   socket = null;
}

function onIOError(e){
   System.print("Socket error, closing socket");
   socket.close(); socket = null;
}

function TCPSend(dvc,cmd){
   str = "ASCIAsnd "+dvc+","+cmd+"\r";
   reInitSocket();
}