Lutron RA2 Connection
JOHNBONZ
Junior Member
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
Comments
-
There's usually a login transaction. Check data text or buffer on your string handler to see if it responds with login:. If so respond accordingly
-
I am conducting a simple test, when I click on a button I want to connect to LUTRON and turn on a light.
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, "' '";
} -
I am conducting a simple test, when I click on a button I want to connect to LUTRON and turn on a light.
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 testDATA.TEXT==', data.Text";
send_string 0, "' '";
}
Isn't the lgoin and password all CAPS? -
It could be all CAPS but it is not getting into the STRING handler.
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 -
[PHP]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,}[/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. -
Update:
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 now you just have to structure your code so that if the connection drops you automatically repeat these steps so you can maintain this connection. This is the type of connection that I usually maintain with out problems. Once you log in you should then send your monitoring commands if you intend to keep track of the lighting, button or keypad states so that lutron will send you strings whenever something changes that you've subscribed to. Once connected you can then just send control commands as if it were a serial device.Update:
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! -
Now I connected to the Lutron RA2 system and can turn ON/OFF Lights, I don't know how to get feedback from the Lutron controller, once connected
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
-
I pulled up a module I started for RA2 when it was 1st rolled out and this is part of what I have in my online event > called function handler:Now I connected to the Lutron RA2 system and can turn ON/OFF Lights, I don't know how to get feedback from the Lutron controller, once connected
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 somethingif(!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. -
From these commands, what was the response from the RA2 controller?
Did you get the status of the devices? Like Dim level? -
I really don't recall since it was probably 5 years ago. I would have to remotely log into a system and see to know for sure but I would expect the monitoring command to work otherwise why have them and why would I have included them. If you don't seem to get anything you could always query the device you just controlled too:From these commands, what was the response from the RA2 controller?
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. -
I changed the login/password when logging into RA2 controller and it does respond when I issue $OUTPUT,34 command which is give me status dim level of device 34. The Lutron tech guy said the use
lutron/integration
I was using lutron/lutron and did get the GNET prompt but for some reason it didn't issue feedback.
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums
