Lutron RA2 Connection
JOHNBONZ
Posts: 99
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
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?
lutron/integration
I was using lutron/lutron and did get the GNET prompt but for some reason it didn't issue feedback.