public class OpenHabRestClient extends Object implements IOpenHabRestClient
OpenHabEventProvider instead.ASK_PATH, COMMAND_PATH, ERR_JSON_CONVERT, GOAL_EXECUTE_GOAL_PATH, GOAL_GOAL_PATH, GOAL_PATH, GOAL_QUALITY_PATH, ITEMS_PATH, REST_PATH, SELECT_PATH, SEMANTIC_LOCATION_PATH, SEMANTIC_LOCATIONS_PATH, SEMANTIC_PATH, SEMANTIC_PERSONS, SEMANTIC_SENSOR_PATH| Constructor and Description |
|---|
OpenHabRestClient(String serverBaseUri)
Creates a new OpenHabRestClient to communicate with OpenHab via rest.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this client.
|
boolean |
executeAsk(String queryStmt,
boolean withLatest)
Executes an AskQuery.
|
boolean |
executeGoal(ExecuteGoalCommandBean cmd)
Executes the given goal on the OH Goal Layer
|
String |
executeSelect(String queryStmt,
boolean withLatest)
Executes a select and gets the result as json string
|
List<Goal> |
getAllGoals()
Gets all goals from the OH Goal Layer
|
List<OpenHabItem> |
getAllItems()
Gets a list with all openhab items.
|
List<SemanticLocation> |
getAllLocations()
Gets all locations from the OH SAL
|
List<Quality> |
getAllQualities()
Gets all qualities from the OH Goal Layer
|
List<eu.vicci.process.devices.core.Sensor> |
getAllSensorsSemantic()
Gets a list with all sensors.
|
String |
getLocationForItem(String itemName)
Gets the location of a item, which is defined in openhab
|
String |
getOpenHabRestVersion()
Gets the current OpenHab rest API version
|
List<eu.vicci.process.model.util.messages.core.SemanticPerson> |
getSemanticPersons()
Gets all available persons semantically annotated
|
String |
getSemanticType(String itemName)
Gets the type of the item, defined in the semantic model
|
void |
postCommand(OpenHabItem item,
String command)
Posts a command to the specified openhab item.
|
String |
postCommandSemantic(String queryStmt,
String command,
boolean withLatest)
Posts a command to semantic layer in OpenHab.
|
public OpenHabRestClient(String serverBaseUri)
CloseableHttpClient which have to be closed after use. Call
close() to close it.serverBaseUri - the Uri where OpenHab is runningpublic String getOpenHabRestVersion()
IOpenHabRestClientgetOpenHabRestVersion in interface IOpenHabRestClientpublic String executeSelect(String queryStmt, boolean withLatest)
IOpenHabRestClientexecuteSelect in interface IOpenHabRestClientqueryStmt - The Select StatementwithLatest - If true, all stateValues in the model will be updated before the query
is executed.public boolean executeAsk(String queryStmt, boolean withLatest)
IOpenHabRestClientexecuteAsk in interface IOpenHabRestClientqueryStmt - The Ask StatementwithLatest - If true, all stateValues in the model will be updated before the query
is executed.public String postCommandSemantic(String queryStmt, String command, boolean withLatest)
IOpenHabRestClientpostCommandSemantic in interface IOpenHabRestClientqueryStmt - The query should select the functionalities, which should receive the
command. E.g. '?subject dogont:hasFunctionality ?func' where the var
'?func' represents all the functionalities, which receives the command.command - The command, supported by the functionalities and the specific items.public String getLocationForItem(String itemName)
IOpenHabRestClientgetLocationForItem in interface IOpenHabRestClientpublic String getSemanticType(String itemName)
IOpenHabRestClientgetSemanticType in interface IOpenHabRestClientpublic List<OpenHabItem> getAllItems()
IOpenHabRestClientgetAllItems in interface IOpenHabRestClientpublic List<eu.vicci.process.model.util.messages.core.SemanticPerson> getSemanticPersons()
IOpenHabRestClientgetSemanticPersons in interface IOpenHabRestClientpublic void close()
IOpenHabRestClientclose in interface IOpenHabRestClientpublic List<eu.vicci.process.devices.core.Sensor> getAllSensorsSemantic()
IOpenHabRestClientgetAllSensorsSemantic in interface IOpenHabRestClientpublic void postCommand(OpenHabItem item, String command)
IOpenHabRestClientpostCommand in interface IOpenHabRestClientpublic List<SemanticLocation> getAllLocations()
IOpenHabRestClientgetAllLocations in interface IOpenHabRestClientpublic List<Quality> getAllQualities()
IOpenHabRestClientgetAllQualities in interface IOpenHabRestClientpublic List<Goal> getAllGoals()
IOpenHabRestClientgetAllGoals in interface IOpenHabRestClientpublic boolean executeGoal(ExecuteGoalCommandBean cmd)
IOpenHabRestClientexecuteGoal in interface IOpenHabRestClientCopyright © 2018. All rights reserved.