Lutron RA2 Connection
I am trying to connect to a Lutron RA2 controller, and can connect using telnet but what to use AMX Netlinks code.
So the first thing I do is:
dvLutronPort = 0:4:0;
IP_CLIENT_OPEN(dvLutronPort.PORT,'192.168.1.81',80 ,TCP_IP);
Then I issue command
cLutronStr = "'#OUTPUT,35,1,50',$0D";
send_string dvLutronPort,cLutronStr;
This doesn't work as I am missing something.
Do I need to send a user/password like I have to enter when I go thru telnet? If so what is the syntax?
Thanks
So the first thing I do is:
dvLutronPort = 0:4:0;
IP_CLIENT_OPEN(dvLutronPort.PORT,'192.168.1.81',80 ,TCP_IP);
Then I issue command
cLutronStr = "'#OUTPUT,35,1,50',$0D";
send_string dvLutronPort,cLutronStr;
This doesn't work as I am missing something.
Do I need to send a user/password like I have to enter when I go thru telnet? If so what is the syntax?
Thanks
0
Comments
When I click button TEST_CONNECTION, I then do this:
:
---- IP_CLIENT_OPEN(dvLutron.PORT,'192.168.1.81',80,TCP _IP); -- IS 80 correct Port for LUTRON?
but this does not INVOKE the STRING HANDLER, but the ONLINE HANDLER is INVOKED
The code in the DATA_EVENT for dvLutron is below but it is not getting to STRING event but it goes to ONLINE event of DATA_EVENT[dvLutron]
How does Lutron send back a login prompt? I expected Lutron to ask for a login from STRING handler:
DATA_EVENT[dvLutron]
STRING:
if(find_string(data.text,'login:',1))
{
send_string dvLutron, "cLutronLogin, $0D,$0A"
}
else if(find_string(data.text,'password:',1))
{
send_string dvLutron, "cLutronPass, $0D,$0A"
}
else if(find_string(data.text,'GNET>',1))
{
send_string 0, "' '";
send_string 0, "'
LUTRON RADIO RA2 ONLINE
', time";
send_string 0, "' '";
}
ONLINE:
{
send_string 0, "'******************************'";
send_string 0, "'LUTRON DATA_EVENT dvLutron--ONLINE: dvLutron'";
send_string 0, "'strLutronBuff=', strLutronBuff";
send_string 0, "'I am conducting a simple test DATA.TEXT==', data.Text";
send_string 0, "' '";
}
Isn't the lgoin and password all CAPS?
All I am doing is following:
1) click button to connect to LUTRON
IP_CLIENT_OPEN(dvLutron.PORT,'192.168.1.81',80,TCP _IP); -- IS 80 correct Port for LUTRON?
2) in the DATA_EVENT handler for dvLutron it goes to ONLINE but not in STRING, because it closes the connection
Line 12 (09:22:07)::
Line 13 (09:22:07):: ABOUT TO OPEN dvLutron
Line 14 (09:22:07):: slCONNECT_STATUS=0
Line 15 (09:22:07):: Connected Successfully
Line 16 (09:22:07):: CIpEvent::OnLine 0:4:1
Line 17 (09:22:07):: ******************************
Line 18 (09:22:07):: LUTRON DATA_EVENT dvLutron--ONLINE: dvLutron
Line 19 (09:22:07):: AAA strLutronBuff=
Line 20 (09:22:07):: AAA ONLINE data.Text=
Line 21 (09:22:07)::
Line 22 (09:22:07):: Exiting TCP Read thread - closing this socket for local port 4
Line 23 (09:22:07):: CIpEvent::OffLine 0:4:1
Line 24 (09:22:07):: ******************************
Line 25 (09:22:07):: dvLutron DATA_EVENT dvLutron--OFFLINE: dvLutron
Line 26 (09:22:07):: AAA strLutronBuff=
Line 27 (09:22:07):: AAA DATA.TEXT=
Can anyone see what I am missing to establish this connection?
Once I goto the STRING handler I then can issue login command to the Lutron controlller
send_string dvLutron, "cLutronLogin, $0D,$0A"
}
else if(find_string(data.text,'password:',1)){
send_string dvLutron, "cLutronPass, $0D,$0A"
}
else if(find_string(data.text,'GNET>',1)){
send_string 0, "' '";
send_string 0, "'
LUTRON RADIO RA2 ONLINE
', time";
send_string 0,}[/PHP]
the way you have your code written the only way something is going to happen in the string event is if data.text="login","password:" or "GNET>"
so, for example if the terminal responded with the text "LOGIN" your code is never going to fire.
I would put a send_string 0," 'the string was:',data.text" right after string:{ so you will see whatever comes in regardless of the "IF" statements.
I had the wrong port number it should be port 23
IP_CLIENT_OPEN(dvLutron.PORT,'192.168.1.81',23,TCP _IP);
Then the system responded with
Line 22 (10:24:38)::
Line 23 (10:24:38):: dvLutron --DATA_EVENT STRING dvLutron
Line 26 (10:24:38):: AAA DATA.TEXT==login:
Then I sent the login id of 'lutron'
then system responded with password
Line 29 (10:24:38)::
Line 30 (10:24:38):: dvLutron --DATA_EVENT STRING dvLutron
Line 33 (10:24:38):: AAA DATA.TEXT==password:
Then I sent the password of 'lutron'
Then system responded with
Line 37 (10:24:38):: dvLutron --DATA_EVENT STRING dvLutron
Line 40 (10:24:38):: AAA DATA.TEXT==$0D$0AGNET>
which means it is connected then I can then send my lighting commands.
So it works!
So if I issue a MONITOROTING command or a #OUTPUT command, I would like to see feedback from the controller, like I want to know Dim level or status of Device.
I think I am missing something
if(!sRA2.sStatus.nDev_Is_IP) { SEND_COMMAND dvRA2_1,'SET BAUD 9600,N,8,1 485 DISABLE'; fnRA2_Q_QCmd("'#MONITORING,1,1'");//enable Diagnostic Monitoring //fnRA2_Q_QCmd("'#MONITORING,1,2'");//disable Diagnostic Monitoring fnRA2_Q_QCmd("'#MONITORING,2,1'");//enable Event Monitoring //fnRA2_Q_QCmd("'#MONITORING,2,2'");//disable Event Monitoring fnRA2_Q_QCmd("'#MONITORING,3,1'");//enable Button Monitoring //fnRA2_Q_QCmd("'#MONITORING,3,2'");//disable Button Monitoring fnRA2_Q_QCmd("'#MONITORING,4,1'");//enable LED Monitoring //fnRA2_Q_QCmd("'#MONITORING,4,2'");//disable LED Monitoring fnRA2_Q_QCmd("'#MONITORING,5,1'");//enable Zone Monitoring //fnRA2_Q_QCmd("'#MONITORING,5,2'");//disable Zone Monitoring fnRA2_Q_QCmd("'#MONITORING,8,1'");//enable Scene # //fnRA2_Q_QCmd("'#MONITORING,8,2'");//disable Scene # fnRA2_Q_QCmd("'#MONITORING,11,1'");//enable Reply State (if disabled, all messages FROM theintegration access point will cease) //fnRA2_Q_QCmd("'#MONITORING,11,2'");//disable Reply State (if disabled, all messages FROM theintegration access point will cease) fnRA2_Q_QCmd("'#MONITORING,12,1'");//enable Prompt State (if disabled, the prompt will not be printed to the terminal) //fnRA2_Q_QCmd("'#MONITORING,12,2'");//disable Prompt State (if disabled, the prompt will not be printed to the terminal) fnRA2_Q_QCmd("'#MONITORING,255,1'");//enable Set (#) or Get (?) State of All Monitoring (except Reply and Prompt) //fnRA2_Q_QCmd("'#MONITORING,255,2'");//disable enable Set (#) or Get (?) State of All Monitoring (except Reply and Prompt) }Now I have no recollection why I do this for a serial connection and not an IP connection since they should be functionally the same if the connection is maintained. When I needed this back in the day I connected via RS232 since I believed then if it was close enough,always direct connect, so that lights would still work if the network crashed. Of course if that happened the TPs wouldn't work so that pretty much defeats that logic.Obviously to send all those at once you'll need a queue function to pace their sending. IMHO you should always have a queue function even if you typical just send one command in a button push.
Did you get the status of the devices? Like Dim level?
fnRA2_Q_QCmd("'?DEVICE,',itoa(RA2_MSTR_1_DEV_ID),',',itoa(nCountLEDs + 100),',9'"); fnRA2_Q_QCmd("'?OUTPUT,',itoa(nCountDL),',1'");one of those might do the trick.lutron/integration
I was using lutron/lutron and did get the GNET prompt but for some reason it didn't issue feedback.