Proxy Server for innogy SmartHome Binding


I have tried to configure a proxy server by using the EXTRA_JAVA_OPTS in /etc/default/openhab2 as suggested in [1] and [2].

EXTRA_JAVA_OPTS="-Dhttp.proxySet=true -Dhttps.proxyPort=8080 -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts='localhost|'"

But I think the InnogyWebSocket isn’t picking up these proxy settings:

10:05:45.859 [ERROR] [gysmarthome.internal.InnogyWebSocket] - innogy WebSocket onError() - Connect Timeout
2018-10-08 10:05:46.587 [ERROR] [marthome.handler.InnogyBridgeHandler] - Error starting websocket.
java.util.concurrent.ExecutionException: Connect Timeout
        at org.eclipse.jetty.util.FuturePromise.get( [87:org.eclipse.jetty.util:9.3.21.v20170918]
        at org.openhab.binding.innogysmarthome.internal.InnogyWebSocket.start( [196:org.openhab.binding.innogysmarthome:2.3.0]
        at org.openhab.binding.innogysmarthome.handler.InnogyBridgeHandler$ [196:org.openhab.binding.innogysmarthome:2.3.0]
        at java.util.concurrent.Executors$ [?:?]
        at [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201( [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:?]
        at java.util.concurrent.ThreadPoolExecutor$ [?:?]
        at [?:?]
Caused by: Connect Timeout
        at$ ~[?:?]

May it be possible that the proxy has to be explicitly set in the WebSocketClient constructor by using the HttpClient?

This might be a possible solution:

SslContextFactory sslContextFactory = new SslContextFactory();
// sslContextFactory.setTrustAll(true); // The magic

HttpClient httpClient = new HttpClient(sslContextFactory);

// Optional add proxy to httpClient
if (StringUtils.isNotEmpty(config.getProxyHost()) && StringUtils.isNotEmpty(config.getProxyPort())) {
	LOGGER.debug("Use Proxy for Websocket: " + config.getProxyHost() + ":" + config.getProxyPort());
	ProxyConfiguration proxyConfig = httpClient.getProxyConfiguration();
	HttpProxy proxy = new HttpProxy(config.getProxyHost(), Integer.parseInt(config.getProxyPort()));
// Start HttpClient

// Create WebSocketClient
client = new WebSocketClient(httpClient);

Or is there another fix to get the innogy SmartHome binding working with a proxy server?


[1] Proxy Server for HTTP Binding
[2] Set up HTTP Bindings when openHAB runs behind a HTTP proxy