[remoteopenhab] Reduced response size from REST API items (#9284)
Related to #9281 Signed-off-by: Laurent Garnier <lg.hc@free.fr>pull/9287/head
parent
12183f1c46
commit
fea317a675
|
@ -324,7 +324,7 @@ public class RemoteopenhabBridgeHandler extends BaseBridgeHandler
|
|||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
"OH 1.x server not supported by the binding");
|
||||
} else if (getThing().getStatus() != ThingStatus.ONLINE) {
|
||||
List<RemoteopenhabItem> items = restClient.getRemoteItems();
|
||||
List<RemoteopenhabItem> items = restClient.getRemoteItems("name,type,groupType,state,stateDescription");
|
||||
|
||||
createChannels(items, true);
|
||||
setStateOptions(items);
|
||||
|
|
|
@ -149,9 +149,12 @@ public class RemoteopenhabRestClient {
|
|||
}
|
||||
}
|
||||
|
||||
public List<RemoteopenhabItem> getRemoteItems() throws RemoteopenhabException {
|
||||
public List<RemoteopenhabItem> getRemoteItems(@Nullable String fields) throws RemoteopenhabException {
|
||||
try {
|
||||
String url = String.format("%s?recursive=false", getRestApiUrl("items"));
|
||||
if (fields != null) {
|
||||
url += "&fields=" + fields;
|
||||
}
|
||||
String jsonResponse = executeUrl(HttpMethod.GET, url, "application/json", null, null);
|
||||
if (jsonResponse.isEmpty()) {
|
||||
throw new RemoteopenhabException("JSON response is empty");
|
||||
|
|
Loading…
Reference in New Issue