diff --git a/addons/binding/org.openhab.binding.tradfri/src/main/java/org/openhab/binding/tradfri/internal/handler/TradfriGatewayHandler.java b/addons/binding/org.openhab.binding.tradfri/src/main/java/org/openhab/binding/tradfri/internal/handler/TradfriGatewayHandler.java index 42d216875f131..b152b08a30847 100644 --- a/addons/binding/org.openhab.binding.tradfri/src/main/java/org/openhab/binding/tradfri/internal/handler/TradfriGatewayHandler.java +++ b/addons/binding/org.openhab.binding.tradfri/src/main/java/org/openhab/binding/tradfri/internal/handler/TradfriGatewayHandler.java @@ -340,6 +340,15 @@ private synchronized void requestDeviceDetails(String instanceId) { @Override public void setStatus(ThingStatus status, ThingStatusDetail statusDetail) { + + // to fix connection issues after a gateway reboot, a session resume is forced for the next command + if (status == ThingStatus.OFFLINE && statusDetail == ThingStatusDetail.COMMUNICATION_ERROR) { + logger.debug("Gateway communication error. Forcing session resume on next command."); + TradfriGatewayConfig configuration = getConfigAs(TradfriGatewayConfig.class); + InetSocketAddress peerAddress = new InetSocketAddress(configuration.host, configuration.port); + this.dtlsConnector.forceResumeSessionFor(peerAddress); + } + // are we still connected at all? if (endPoint != null) { updateStatus(status, statusDetail);