public class ISYRestRequester extends RestRequester
Modifier and Type | Field and Description |
---|---|
protected static String |
CLASSNAME |
static String[] |
ClimateCloudConditions |
static String[] |
ClimateCoverage |
static String[] |
ClimateIntensity |
static String[] |
ClimateWeatherConditions |
protected static boolean |
debugOut_ |
protected static String |
DEFAULT_ISY994_IP
DEFAULT ISY994 IP address to use: 10.0.0.207 .
|
protected static String |
DEFAULT_ISY994_PASSWORD
DEFAULT ISY994 password to use: admin .
|
protected static String |
DEFAULT_ISY994_REST_URL_PATHSTR
DEFAULT ISY994 rest URL to start the URL path: /rest .
|
protected static String |
DEFAULT_ISY994_USERNAME
DEFAULT ISY994 username to use: admin .
|
static String |
DWNKITCHEN_ADDR |
static String |
DWNKITCHEN_NODENAME |
static String |
FAMILYMAINLIGHTS_ADDR |
static String |
GAMESROOMLIGHTS_ADDR |
static String |
GAMESROOMLIGHTS_NODENAME |
protected static StringBuilder |
helpMsg_ |
static IsyVars |
isyIntVars_ |
static IsyNodes |
isyNodes_ |
static IsyVars |
isyStateVars_ |
static String |
LOG_TAG |
protected String |
restUrlPath_
The start path to use in therest URL.
|
static String |
THERMOSTAT_ADDR |
protected static String |
TOMS_ISY994_IP |
protected static String |
TOMS_ISY994_PASSWORD |
protected static String |
TOMS_ISY994_USERNAME |
protected static boolean |
tomsIsy_
flag to indicate the use of TOMS_isy IP, userID, and password.
|
static String |
TVDIM_ADDR |
static String |
VALENCEFRONTLIGHTS_ADDR |
static String |
VALENCESURROUNDLIGHTS_ADDR |
acceptJSON_, authenticating_, baseUrl_, password_, SYSTEM_FILE_SEPERATOR, SYSTEM_LINE_SEPERATOR, USER_AGENT, username_
Constructor and Description |
---|
ISYRestRequester()
Default constructor that authenticates the default ISY with the default user password (using the class vars)
UNLESS the tomsIsy_ class var is true to over-ride with TOMS _isy IP, userID, and password.
|
ISYRestRequester(boolean useDefault)
Default constructor that authenticates and connects the ISY with a choice of either the default user password
(using the class vars) or with TOMS _isy IP, userID, and password..
|
ISYRestRequester(String server,
String user,
String pass)
Constructor to customize all connection settings.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canConnect()
Check connectivity to the ISY specified by the class parms.
|
int |
deviceAddressIntProperty(String addr,
String prop)
returns a devices property int value with /rest/nodes/
|
StringBuilder |
deviceAddressOff(String addr)
Sends a REST call turn a Node OFF '/nodes/
|
StringBuilder |
deviceAddressOn(String addr)
Sends a REST call turn a Node or scene ON '/nodes/
|
StringBuilder |
deviceAddressOn(String addr,
int brightness)
Sends a REST call turn a Node ON '/nodes/
|
IsyDeviceProperty |
deviceAddressProperty(String addr,
String prop)
returns a devices property with /rest/nodes/
|
String |
deviceAddressPropertyUOM(String addr,
String prop)
returns a devices property int value with /rest/nodes/
|
String |
deviceAddressPropertyXML(String addr,
String prop)
returns a devices property XML String with /rest/nodes/
|
int |
deviceAddressStatus(String addr) |
int |
deviceAddressStatus(String addr,
boolean includeScenes)
returns the on/off/% for a specified node address.
|
int |
deviceAddressToggle(String addr)
Toggles the ON/OFF state specified device.
|
StringBuilder |
deviceOff(String nodeName)
Sends a REST call turn a Node or scene OFF '/nodes/
|
StringBuilder |
deviceOn(String nodeName)
Sends a REST call turn a Node or scene ON '/nodes/
|
IsyDeviceProperty |
deviceProperty(String nodeName,
String prop)
returns a devices property formatted String with /rest/nodes/
|
String |
devicePropertyFormattedValue(String nodeName,
String prop)
returns a devices property formatted String with /rest/nodes/
|
String |
devicePropertyValue(String nodeName,
String prop)
returns a devices property Value (which is the unformatted value) String with /rest/nodes/
|
String |
devicePropertyXML(String nodeName,
String prop)
returns a devices property XML String with /rest/nodes/
|
int |
deviceStatus(String nodeName)
Queries the status of the device/node NAMED nodeName.
|
int |
deviceToggle(String nodeName)
Toggles the state of the device/node NAMED nodeName.
|
StringBuilder |
getConfig()
returns isy config.
|
protected static StringBuilder |
getHelpMsg()
initializes and gets the helpMsg_
class var.
|
protected static String |
getHelpMsgStr()
gets the help as a String.
|
IsyVars |
getIsyIntVars()
Returns class var 'isyIntVars_'.
|
IsyVars |
getIsyStateVars()
Returns class var 'isyStateVars_'.
|
int |
getNextAvailableIntVarID()
Gets a the next un=used/avaialbe varID.
|
int |
getNextAvailableIntVarID(boolean reQueryVars) |
int |
getNextAvailableStateVarID()
Gets a the next un=used/avaialbe varID.
|
int |
getNextAvailableStateVarID(boolean reQueryVars) |
StringBuilder |
getNodes()
returns all the nodes.
|
protected String |
getPropertyCMD(String[] args)
commandLine command executor method for the getProperty Command.
|
protected String |
getPropertyUOM(String[] args)
commandLine command executor method for the getProperty Command.
|
protected String |
getPropertyValue(String nodeName,
String propName)
commandLine command executor method for the getProperty Command.
|
StringBuilder |
getQuery()
queries all the nodes.
|
StringBuilder |
getQueryNode(String nodeName)
queries the nodes with name.
|
StringBuilder |
getQueryNodeFromAddress(String nAddr)
queries the nodes with address.
|
String |
getRestUrlPath()
Get Method for class field 'restUrlPath_'.
|
StringBuilder |
getStatus()
returns the status for all the nodes.
|
static boolean |
getTomsIsy()
Get Method for class field 'tomsIsy_'.
|
protected int |
getVarCMD(String arg) |
protected int |
getVarCMD(String[] args)
commandLine command executor method for the getVar Command.
|
StringBuilder |
getVariable(String varID,
int varType)
Gets the current XML (StringBuffer) result for an ISY variable.
|
int |
getVariableIntValue(String varID,
int varType)
Gets the current XML (StringBuffer) result for an ISY variable.
|
int |
groupAddressStatus(String addr)
returns the on/off/% fora specified scene/group address.
|
protected void |
listNodesCMD(String[] args)
commandLine command executor method for the listNodes Command.
|
protected void |
listScenesCMD(String[] args)
commandLine command executor method for the listScenes Command.
|
protected void |
listVarsCMD(String[] args)
commandLine command executor method for the listVars Command.
|
static void |
main(String[] args)
Class main commandLine entry method that has a test command and some convienience commands, as well as a pure rest command.
|
IsyNodes |
parseAllNodes()
Parses all the NODEs in the ISY into the isyNodes_ var.
|
IsyNodes |
parseAllNodes(boolean reloadFromISY)
Parses all the NODEs in the ISY into the isyNodes_ var.
|
StringBuilder |
queryAllIntegerVars()
Fully Queries and loads all Integer vars.
|
StringBuilder |
queryAllIntVarVals()
Not Implemented.
|
StringBuilder |
queryAllNodes()
Sends a REST call to query all nodes and scenes; '/nodes' .
|
StringBuilder |
queryAllNodesAndScenes()
Sends a REST call to query all scenes; '/nodes/scenes' .
|
StringBuilder |
queryAllScenes()
Sends a REST call to query all scenes; '/nodes/scenes' .
|
StringBuilder |
queryAllStateVars()
Fully Queries and loads all state vars.
|
StringBuilder |
queryAllVars(int varType)
Sends a REST call to query all Variables defined; '/vars/definitions/
|
StringBuilder |
queryAllVarValues(int varType)
Sends a REST call to query all Variables values; 'vars/get/
|
protected void |
restCMD(String[] args)
commandLine command executor method for the default rest Command.
|
void |
setRestUrlPath(String restUrlPath)
Set Method for class field 'restUrlPath_'.
|
static void |
setTomsIsy_(boolean tomsIsy)
Set Method for class field
tomsIsy_ . |
StringBuilder |
setVariable(int varId,
String varVal,
int varType)
Sets a ISY variable.
|
protected void |
statusCMD(String[] args)
commandLine status command method for the status Command.
|
protected void |
templateCMD(String[] args)
Template method for future commandLine command executor methods.
|
protected void |
testCMD(String[] args)
commandLine command executor method for the test Command.
|
protected int |
toggleCMD(String[] args)
commandLine command executor method for the toggle Command.
|
int |
toggleLight(String arg)
commandLine command executor method for the toggle Command.
|
callService, callService, getAcceptJSON, getBaseUrl, getPassword, getServiceUrl, getUsername, isInit, responseIndenter, serviceGet, servicePost, setAcceptJSON, setBaseUrl, setPassword, setUsername
protected static final String CLASSNAME
public static final String LOG_TAG
protected static final String DEFAULT_ISY994_IP
protected static final String DEFAULT_ISY994_USERNAME
protected static final String DEFAULT_ISY994_PASSWORD
protected static final String DEFAULT_ISY994_REST_URL_PATHSTR
protected static final String TOMS_ISY994_IP
protected static final String TOMS_ISY994_USERNAME
protected static final String TOMS_ISY994_PASSWORD
protected static StringBuilder helpMsg_
protected static boolean debugOut_
protected static boolean tomsIsy_
public static IsyVars isyIntVars_
public static IsyVars isyStateVars_
public static String[] ClimateCoverage
public static String[] ClimateIntensity
public static String[] ClimateWeatherConditions
public static String[] ClimateCloudConditions
protected String restUrlPath_
public static final String TVDIM_ADDR
public static final String GAMESROOMLIGHTS_NODENAME
public static final String GAMESROOMLIGHTS_ADDR
public static final String DWNKITCHEN_NODENAME
public static final String DWNKITCHEN_ADDR
public static final String THERMOSTAT_ADDR
public static final String FAMILYMAINLIGHTS_ADDR
public static final String VALENCEFRONTLIGHTS_ADDR
public static final String VALENCESURROUNDLIGHTS_ADDR
public ISYRestRequester()
tomsIsy_
class var is false.public ISYRestRequester(boolean useDefault)
public ISYRestRequester(String server, String user, String pass)
public static void setTomsIsy_(boolean tomsIsy)
tomsIsy_
.tomsIsy
- is the value to set this class field to.public static boolean getTomsIsy()
tomsIsy_
.public void setRestUrlPath(String restUrlPath)
restUrlPath_
- is the value to set this class field to.public String getRestUrlPath()
public boolean canConnect()
public StringBuilder queryAllNodes()
public StringBuilder queryAllScenes()
public StringBuilder queryAllNodesAndScenes()
public IsyNodes parseAllNodes()
public IsyNodes parseAllNodes(boolean reloadFromISY)
reloadFromISY
- forces the re- query from the isy (else it just returns the existing isyNodes_.public StringBuilder queryAllVars(int varType)
public StringBuilder queryAllVarValues(int varType)
public StringBuilder queryAllIntegerVars()
public StringBuilder queryAllStateVars()
public IsyVars getIsyIntVars()
public IsyVars getIsyStateVars()
public StringBuilder queryAllIntVarVals()
public StringBuilder deviceOn(String nodeName)
nodeName
- the nodes NAME to turn ONpublic StringBuilder deviceOff(String nodeName)
nodeName
- the nodes NAME to turn OFFpublic StringBuilder deviceAddressOn(String addr)
addr
- the nodes address (ie. 16 10 A0 1) to turn OFFpublic StringBuilder deviceAddressOn(String addr, int brightness)
addr
- the nodes address (ie. 16 10 A0 1) to turn Onbrightness
- the brightness (0-255)public StringBuilder deviceAddressOff(String addr)
addr
- the nodes address (ie. 16 10 A0 1) to turn OFFpublic int deviceToggle(String nodeName)
nodeName
- the nodes NAME to toggle its statepublic int deviceAddressToggle(String addr)
public int deviceStatus(String nodeName)
nodeName
- the nodes NAME to query its statuspublic int deviceAddressStatus(String addr)
public int deviceAddressStatus(String addr, boolean includeScenes)
public int groupAddressStatus(String addr)
public StringBuilder setVariable(int varId, String varVal, int varType)
varName
- varId
- varType
- send a 1 for Integer and 2 for Statepublic StringBuilder getVariable(String varID, int varType)
varID
- varType
- send a 1 for Integer and 2 for Statepublic int getVariableIntValue(String varID, int varType) throws Exception
varID
- varType
- send a 1 for Integer and 2 for StateException
public int getNextAvailableStateVarID()
public int getNextAvailableStateVarID(boolean reQueryVars)
public int getNextAvailableIntVarID()
public int getNextAvailableIntVarID(boolean reQueryVars)
public StringBuilder getStatus()
public StringBuilder getQuery()
public StringBuilder getQueryNode(String nodeName)
public StringBuilder getQueryNodeFromAddress(String nAddr)
public StringBuilder getNodes()
public StringBuilder getConfig()
public String devicePropertyValue(String nodeName, String prop)
public String devicePropertyFormattedValue(String nodeName, String prop)
public String devicePropertyXML(String nodeName, String prop)
public String deviceAddressPropertyXML(String addr, String prop)
public int deviceAddressIntProperty(String addr, String prop)
public String deviceAddressPropertyUOM(String addr, String prop)
public IsyDeviceProperty deviceProperty(String nodeName, String prop)
public IsyDeviceProperty deviceAddressProperty(String addr, String prop)
public static void main(String[] args)
protected void testCMD(String[] args)
args
- the array of commandLine args that got passed inprotected void listNodesCMD(String[] args)
args
- the array of commandLine args that got passed inprotected void listScenesCMD(String[] args)
args
- the array of commandLine args that got passed inprotected void listVarsCMD(String[] args)
args
- the array of commandLine args that got passed inpublic int toggleLight(String arg)
args
- the lightname to toggleprotected int toggleCMD(String[] args)
args
- the array of commandLine args that got passed inprotected void statusCMD(String[] args)
args
- the array of commandLine args that got passed inargs
- is an array of stringas that get concatenated into the single NODE name to get status for.protected void restCMD(String[] args)
args
- the array of commandLine args that got passed inprotected int getVarCMD(String[] args) throws Exception
args
- the array of commandLine args that got passed inException
protected String getPropertyValue(String nodeName, String propName)
args
- the array of commandLine args that got passed inprotected String getPropertyCMD(String[] args)
args
- the array of commandLine args that got passed inprotected String getPropertyUOM(String[] args)
args
- the array of commandLine args that got passed inprotected void templateCMD(String[] args)
args
- the array of commandLine args that got passed inprotected static String getHelpMsgStr()
protected static StringBuilder getHelpMsg()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses