RTI to AMX via Serial
I am doing a job in-which we are using RTI remotes to control an AMX system. To do that I am planning on using an RTI XP-8 and connect it to the AMX master via RS232 and associate every button on the RTI remote with an RS232 command and send it to the master.
I was wondering if anyone has done this before and could share some tips. Has anyone made a driver/module to do this as I know that their is one available for RTI to ********.
P.S: I know you can do it over RF with AMX RF Ants but there are not enough RF codes and.
I was wondering if anyone has done this before and could share some tips. Has anyone made a driver/module to do this as I know that their is one available for RTI to ********.
P.S: I know you can do it over RF with AMX RF Ants but there are not enough RF codes and.
0
Comments
The protocol I setup is as follows:
Header:Action:Zone
Where Header is something like PC (power control), VC (volume Control), SS (source select), BP (button push), etc.
So a command would look something like this:
PC:01:03
That would turn on zone three.
You can setup the protocol however you like though.
Use the virtual as you would any AMX device and have full push/hold/release control from RTI.
If we need to do it again, I would create an iP driver for RTI that did the same thing. Load up a driver for each remote you have. They loved the T1B's so much we wound up doing 12 of them around the house and that got expensive on both the RTI and AMX side port wise.
Kevin D.
Just to simplify my burden. I was wondering if anyone could post some sample code.
Once i have finished this project with RS232 I may write an RTI driver to allow for IP control or at least simplify the procedure (or something more native).
DATA_EVENT[dvRTI] { ONLINE: { SEND_COMMAND dvRTI, "'SET BAUD 9600,N,8,1, 485 DISABLE'" } STRING: { //"RMxxCHxxx" - RM = Room 01 and CH = Channel to push 001 IF(FIND_STRING(RTI_BUFFER,'RM',1)) { RTI_ROOM = ATOI (MID_STRING(RTI_BUFFER,3,2)) RTI_CMD = ATOI (MID_STRING(RTI_BUFFER,7,3)) send_string 0, "'String From RTI = ', RTI_BUFFER" send_string 0, "'ROOM = ', RTI_ROOM" send_string 0, "'CMD = ', RTI_CMD" SWITCH(RTI_ROOM) { CASE 1: { DO_PUSH(vdvRemote1,RTI_CMD) } CASE 2: { //DO_PUSH(vdvRemote2,RTI_CMD) } } WAIT 5 CLEAR_BUFFER RTI_BUFFER } ELSE { CLEAR_BUFFER RTI_BUFFER } } }Any suggestions or sample code? Thanks!
Another problem might have bee your wait 5 clear buffer since when the wait expires it may fire just as data comes in prior to the data event triggering or maybe it fires and dumps the buffer before the you have a complete string although that's not really likely with these short strings but for that reason I always like to cancel the wait and then wait so that it doesn't dump until the data event handler has been idle for the wait period.
This code isn't tested or compiled so there might be error but this is sort of how would deal with it and might fix you issues with multiple room pushes at the same time.
DATA_EVENT[dvRTI] { ONLINE: { SEND_COMMAND dvRTI, "'SET BAUD 9600,N,8,1, 485 DISABLE'" } STRING: { //"RMxxCHxxx" - RM = Room 01 and CH = Channel to push 001 send_string 0, "'RTI, RX-[ ', DATA.TEXT,' ]'"; CANCEL_WAIT 'RTI_DUMP_BUFFER';//prevent dumping buffer if data is coming in, might dump data before data event fires WHILE(FIND_STRING(RTI_BUFFER,'CH',1))//having a delimiter would be nice but... { STACK_VAR INTEGER nFBS; STACK_VAR CHAR cStr[128];//larger than needed in case there's junk nFBS = find_string(RTI_BUFFER,'CH',1); if(length_string(RTI_BUFFER) >= nFBS + 4)//make sure we have at least 3 digits since no delimiter { cStr = GET_BUFFER_STRING(RTI_BUFFER,nFBS + 4); send_string 0, "'RTI, Parsing Segment-[ ', cStr,' ]'"; REMOVE_STRING(cStr,'RM',1);//get rid of RM and any junk before it RTI_ROOM = aoti(GET_BUFFER_STRING(cStr,2); //RTI_CMD = atoi(RIGHT_STRING(cStr,3);// //or just RTI_CMD = atoi(cStr); send_string 0, "'RTI, ROOM = ', itoa(RTI_ROOM)" send_string 0, "'RTI, CMD = ', itoa(RTI_CMD)" SWITCH(RTI_ROOM) { CASE 1: { DO_PUSH_TIMED(vdvRemote1,RTI_CMD,1);//use timed, otherwise another push won't work for .5 seconds //DO_RELEASE(vdvRemote1,RTI_CMD);//if you need the release even faster } CASE 2: { DO_PUSH_TIMED(vdvRemote2,RTI_CMD,1);//used timed, otherwise another push won't work for .5 seconds //DO_RELEASE(vdvRemote2,RTI_CMD);//if you need the release even faster } } } else { send_string 0, "'RTI, Parsing ERROR, Segment-[ ',RTI_BUFFER,' ]'"; WAIT 50 'RTI_DUMP_BUFFER' { CLEAR_BUFFER RTI_BUFFER; } } } WAIT 50 'RTI_DUMP_BUFFER' { if(length_string(RTI_BUFFER)) { send_string 0, "'RTI, Dumping buffer remains, BUFFER-[ ',RTI_BUFFER,' ]'"; CLEAR_BUFFER RTI_BUFFER; } } } }Edit:
Looking at the code I posted there's a potential for the while loop to hang if there isn't 3 or more characters after the CH. If no more data comes in it will time out when the buffer dumps but that still locking up the processor for the duration of the dump wait. If you could add a delimiter like ; or $0d,$0a that would simplify things but you could try changing the while to this you can't: this might work but again it's untested, then you could get rid of the if() that follows the while. Best thing would be to have the RTI strings sent with a delimiter.
Thanks for taking the time to assist me on this. If I use a delimiter, what would be the best approach on the while loop and how would the code look like? I can format my RTI strings like this:
RM01CH001\r
or
01:001\r
RM01 = Room Number, always in 2 digits, like 01, 03, or 13
CH001 = Channel number, always in 3 digits, like 001, 056 or 999
\r = Carriage Return from RTI
DATA_EVENT[dvRTI] { ONLINE: { SEND_COMMAND dvRTI, "'SET BAUD 9600,N,8,1, 485 DISABLE'" } STRING: { //"RMxxCHxxx" - RM = Room 01 and CH = Channel to push 001 SEND_STRING 0, "'RTI, RX-[ ', DATA.TEXT,' ]'"; CANCEL_WAIT 'RTI_DUMP_BUFFER';//prevent dumping buffer if data is coming in, might dump data before data event fires WHILE(FIND_STRING(RTI_BUFFER,'\r',1))//delimiter. { STACK_VAR INTEGER nFBS; STACK_VAR CHAR cStr[64]; cStr = REMOVE_STRING(RTI_BUFFER,'\r',1); SEND_STRING 0, "'RTI, Parsing Segment-[ ', cStr,' ]'"; SET_LENGTH_STRING(cStr,length_string(cStr)-2);//get rid of \r nFBS = find_string(cStr,'RM',1); if(nFBS) { GET_BUFFER_STRING(nFBS+1);//dump RM and anyting before it nFBS = find_string(cStr,'CH',1); if(nFBS) { RTI_ROOM = atoi(GET_BUFFER_STRING(cStr,-1); REMOVE_STRING(cStr,'CH',1); RTI_CMD = atoi(cStr); SEND_STRING 0, "'RTI, PARSED: ROOM-[ ', itoa(RTI_ROOM),' ], CMD-[ ',itoa(RTI_CMD),' ]'"; SWITCH(RTI_ROOM) { CASE 1: { DO_PUSH_TIMED(vdvRemote1,RTI_CMD,1);//use timed, otherwise another push won't work for .5 seconds DO_RELEASE(vdvRemote1,RTI_CMD);//immediately release to allow next push } CASE 2: { DO_PUSH_TIMED(vdvRemote2,RTI_CMD,1);//used timed, otherwise another push won't work for .5 seconds DO_RELEASE(vdvRemote2,RTI_CMD);//immediately release to allow next push } } } else { SEND_STRING 0, "'RTI, Parsing ERROR-[ No CH Found ]'"; } } else { SEND_STRING 0, "'RTI, Parsing ERROR-[ No RM Found ]'"; WAIT 50 'RTI_DUMP_BUFFER' { CLEAR_BUFFER RTI_BUFFER; } } } WAIT 50 'RTI_DUMP_BUFFER' { if(length_string(RTI_BUFFER)) { SEND_STRING 0, "'RTI, Dumping buffer remains, BUFFER-[ ',RTI_BUFFER,' ]'"; CLEAR_BUFFER RTI_BUFFER; } } } }I just ordered some RTI parts today to try this solution at home before I deploy it on the field. I will let you know if it works after I test it.
Again, I appreciate your help.
Ricardo
Krestron uses a URC remote so I wonder why AMX doesn't try and re-brand some RTI models and give up a trying to make there own.
+1000 on this. But it would take a desire to sell in residential for this to make sense for AMX.