An API for Lutron Integration Commands
The Quantum API sends commands and returns information based on the area and light level specified.
Files:
- A simple
PHP
script to send Lutron Integration commands to Processor or NWK over Telnet - A
ini
file containing AREA NAMES and integration IDs- To-do: Create a tool that automatically generates this file from the integration report.
- To-do: Use
JSON
instead ofini
.
Requirements:
- A Quantum installation with Integration IDs
- A networked Quantum Processor on NWK
- A networked Webserver with a public IP that hosts the
index.php
andlutron.ini
files
- NOTE: This Webserver needs to have PHP installed. On IIS, use Windows Platform Installer to get PHP.
- NOTE: This Webserver can be the Quantum Vue webserver. This is probably the simplest method.
The LIGHT LEVEL must be a value between 0 and 100. The AREA and it's integration ID must be specified in the lutron.ini
file. The command will return JSON
ouput.
Installation:
-
Modify the
lutron.ini
file to include:- Your Processor or NWK local IP address
- Your Processor or NWK login information
- Your project's list of AREAS and integration IDs .
- Any spaces in the AREA name should be replaced with UNDERSCORES
- The AREA name goes in the first set of SQUARE BRACKETS (underscored if applicable)
- The itegration ID goes after the
code =
This should probably be accomplished programmatically (see to-dos).
-
Modify the
index.php
file if you:- Decided to place the
lutron.ini
file somewhere else, or rename it. - Want to show less information; the
proc
andconfig
JSON objects are useful for debugging, but should probably not be exposed in production. These lines are marked with//recommend hiding after debuging
.
- Decided to place the
-
Place the
index.php
file andlutron.ini
in the same directory on your networked server.
Usage:
http://yourserver.com/path/to/files/?area=AREANAME&level=LEVEL
Example: http://yourserver.com/path/to/files/?area=entry&level=50
This command will set the lights in ENTRY to 50% and return the following output:
{
"config": {
"telnetPort": "23",
"localIP": "192.168.1.111",
"userName": "USERNAME\r\n"
},
"area": {
"name": "entry",
"exists": true,
"id": "17"
},
"level": "50",
"proc": {
"commandWrite": "#AREA,17,1,50,3\r\n",
"commandRead": "?AREA,17,6\r\n",
"cleartext": "login: password: \r\nQNET> \u0000QNET> ~AREA,17,6,3\r\nQNET> "
}
}