[remoteopenhab] Avoid going OFFLINE when request of items states fails (#9287)

Related to #9281

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2020-12-08 18:22:13 +01:00 committed by GitHub
parent ce5d5ca61d
commit d451648e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,12 +324,18 @@ 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("name,type,groupType,state,stateDescription");
List<RemoteopenhabItem> items = restClient.getRemoteItems("name,type,groupType,stateDescription");
createChannels(items, true);
setStateOptions(items);
for (RemoteopenhabItem item : items) {
updateChannelState(item.name, null, item.state);
try {
items = restClient.getRemoteItems("name,state");
for (RemoteopenhabItem item : items) {
updateChannelState(item.name, null, item.state);
}
} catch (RemoteopenhabException e) {
logger.debug("{}", e.getMessage());
}
updateStatus(ThingStatus.ONLINE);