Search in sources :

Example 1 with KNXLinkClosedException

use of tuwien.auto.calimero.link.KNXLinkClosedException in project openhab1-addons by openhab.

the class KNXBindingDatapointReaderTask method readFromKNXBus.

private void readFromKNXBus(Datapoint datapoint) throws InterruptedException {
    try {
        ProcessCommunicator pc = KNXConnection.getCommunicator();
        if (pc != null) {
            sLogger.debug("Autorefresh: Sending read request to KNX for item '{}' DPT '{}'", datapoint.getName(), datapoint.getDPT());
            pc.read(datapoint);
        } else {
            sLogger.debug("Autorefresh: Couldn't sent read request to KNX for item '{}'. Connection to KNX bus not (yet) established.", datapoint.getName());
        }
    } catch (KNXFormatException e) {
        sLogger.warn("Autorefresh: Cannot read value for item '{}' from KNX bus: {}: invalid format", datapoint.getName(), e.getMessage());
    } catch (KNXInvalidResponseException e) {
        sLogger.warn("Autorefresh: Cannot read value for item '{}' from KNX bus: {}: invalid response", datapoint.getName(), e.getMessage());
    } catch (KNXTimeoutException e) {
        sLogger.warn("Autorefresh: Cannot read value for item '{}' from KNX bus: {}: timeout", datapoint.getName(), e.getMessage());
        addToReadQueue(datapoint);
    } catch (KNXLinkClosedException e) {
        sLogger.warn("Autorefresh: Cannot read value for item '{}' from KNX bus: {}: link closed", datapoint.getName(), e.getMessage());
    } catch (KNXException e) {
        sLogger.warn("Autorefresh: Cannot read value for item '{}' from KNX bus: {}", datapoint.getName(), e.getMessage());
    } catch (KNXIllegalArgumentException e) {
        sLogger.warn("Autorefresh: Error sending KNX read request for '{}': {}", datapoint.getName(), e.getMessage());
    }
}
Also used : KNXInvalidResponseException(tuwien.auto.calimero.exception.KNXInvalidResponseException) KNXTimeoutException(tuwien.auto.calimero.exception.KNXTimeoutException) KNXException(tuwien.auto.calimero.exception.KNXException) KNXLinkClosedException(tuwien.auto.calimero.link.KNXLinkClosedException) KNXIllegalArgumentException(tuwien.auto.calimero.exception.KNXIllegalArgumentException) KNXFormatException(tuwien.auto.calimero.exception.KNXFormatException) ProcessCommunicator(tuwien.auto.calimero.process.ProcessCommunicator)

Aggregations

KNXException (tuwien.auto.calimero.exception.KNXException)1 KNXFormatException (tuwien.auto.calimero.exception.KNXFormatException)1 KNXIllegalArgumentException (tuwien.auto.calimero.exception.KNXIllegalArgumentException)1 KNXInvalidResponseException (tuwien.auto.calimero.exception.KNXInvalidResponseException)1 KNXTimeoutException (tuwien.auto.calimero.exception.KNXTimeoutException)1 KNXLinkClosedException (tuwien.auto.calimero.link.KNXLinkClosedException)1 ProcessCommunicator (tuwien.auto.calimero.process.ProcessCommunicator)1