String error = null;
if (openConnection()) {
- long prevUpdateTime = lastPollingUpdate;
// poll all zones on the amplifier to get current state
amp.getZoneIds().stream().limit(numZones).forEach((streamZoneId) -> {
try {
logger.debug("Error sending Xantech periodic update commands: {}", e.getMessage());
}
}
-
- // prevUpdateTime should have changed if a zone update was received
- if (lastPollingUpdate == prevUpdateTime) {
- error = "@text/offline.communication-error-polling";
- }
} else {
error = "@text/offline.communication-error-reconnection";
}
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, error);
} else {
updateStatus(ThingStatus.ONLINE);
- lastPollingUpdate = System.currentTimeMillis();
}
}
}