Personal OpenHab Cloud to OpenHabian disconnects often

I’m playing around with running my own openhab-cloud server and have it mostly working with one last annoyance.

For background, I’m running my openhab server (3.1.0.M2) on a Raspberry Pi - works great. I’m running my openhab-cloud server (github’s latest) in a docker instance on linux server. I can connect to it and get to my openhab server no problem.

The issue is that I see constant disconnects in the openhab-cloud-connector on my openhab server in the openhab.log:

2021-03-20 16:08:29.362 [ERROR] [io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance
2021-03-20 16:08:29.364 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-20 16:08:30.778 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-20 16:08:40.786 [ERROR] [io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance
2021-03-20 16:08:40.788 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-20 16:08:42.220 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-20 16:08:52.227 [ERROR] [io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance
2021-03-20 16:08:52.229 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-20 16:08:53.356 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)

I can still use the dashboard from my cloud server - everything seems to work, but surely there’s something not right.

I looked through the code for the org.openhab.io.openhabcloud binding, and it looks like the error happens on “Socket.EVENT_ERROR”. I don’t see any other network errors inside my home network, so I don’t believe there’s really a network error.

What else could it be? I tried turning on DEBUG logging (“log:set DEBUG” in the console) and didn’t see anything more.

Any ideas?

This is obviously not getting any traction, so I’m going to write a long description of my setup and hopefully someone can spot something stupid that I’m doing. First a description of how I have the system setup and what happens in various circumstances:

Pertinent network parts:

It looks complex but isn’t really all that bad:

  1. All internet traffic to my domain.com port 443 is forwarded through the firewall to my web server - I have several services available on that port, and everything is fine.
  2. Apache running on my web server does the HTTPS part, and sees traffic for:
  1. The traffic then goes in to the docker instance on web.inside.domain.com/home.inside.domain.com and gets processed by the OpenHab-Cloud instance - the names ensure that the OpenHab-Cloud instance gets the appropriate “home.” leading domain part so it understands the difference between the two connection types.
  2. Return traffic is properly proxied back out to the internet connection.

For the most part this works fine. The OpenHabian server is just sitting on my internal network and works great with internal connections (and also with myopenhab.org cloud connection).

A bit about the OpenHab-Cloud instance I’m running:

  1. It was pulled directly from github.
  2. The .env file was updated reflect the DOMAIN_NAME as home.domain.com (and of course the EXPRESS_KEY was set).
  3. I’m not using Traefik, so I removed that part from the docker-compose.yml file.
  4. I had to comment out some stuff about Android notifications and Apple notifications in app.js because without them configured, I couldn’t get app.js to start. Very minimal modifications.

So, here we are, things should be working as best I can tell.

  1. Web client connection to ohc.domain.com gives me the login or register screen as expected.
  2. I can log in and register everything.
  3. Web client connection to home.domain.com asks for an authentication. Since I just went directly there, I assume things aren’t set up, so it just keeps snoopy people out.

So that’s the state of things before I actually TRY to get things working.

Now, I connect to my OpenHabian (Raspian?) and configure the OpenHAB cloud connector to connect to https://ohc.domain.com.

This is where things go south. The OpenHab server logs start getting the disconnections that I pointed out in my first post:

2021-03-20 16:08:29.362 [ERROR] [io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance
2021-03-20 16:08:29.364 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-20 16:08:30.778 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-20 16:08:40.786 [ERROR] [io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance
2021-03-20 16:08:40.788 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-20 16:08:42.220 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-20 16:08:52.227 [ERROR] [io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance
2021-03-20 16:08:52.229 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-20 16:08:53.356 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)

Every 10 seconds. [And what is that http://localhost:8080 about?? In the source code it doesn’t seem to use that for anything on either side]

I’ve trolled through the source code for the OpenHAB-cloud connector and it only seems to make one connection - to https://ohc.domain.com. It sends some “itemupdates” and those are processed by the openHAB-Cloud instance. It seems good, then it just gets a timeout on the OpenHAB cloud connector side.

I have a debug dump of the cloud logs:

app_1      | 2021-03-28T21:45:52.311Z engine intercepting request for path "/socket.io/"
app_1      | 2021-03-28T21:45:52.313Z engine handling "GET" http request "/socket.io/?EIO=3&transport=polling"
app_1      | 2021-03-28T21:45:52.319Z engine handshaking client "SIDSIDSIDSIDSIDSIDSI"
app_1      | 2021-03-28T21:45:52.321Z engine:socket sending packet "open" ({"sid":"SIDSIDSIDSIDSIDSIDSI","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000})
app_1      | 2021-03-28T21:45:52.322Z engine:polling setting request
app_1      | 2021-03-28T21:45:52.323Z engine:socket flushing buffer to transport
app_1      | 2021-03-28T21:45:52.326Z engine:polling writing "96:0{"sid":"SIDSIDSIDSIDSIDSIDSI","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}"
app_1      | 2021-03-28T21:45:52.334Z engine:socket executing batch send callback
app_1      | 2021-03-28T21:45:52.334Z socket.io:server incoming connection with id SIDSIDSIDSIDSIDSIDSI
app_1      | 2021-03-28T21:45:52.335Z socket.io:client connecting to namespace /
app_1      | 2021-03-28T21:45:52.336Z socket.io:namespace adding socket to nsp /
app_1      | 2021-03-28T21:45:52.386Z mquery findOne openhabs {
app_1      |   uuid: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
app_1      |   secret: 'SECRETSECRETSECRETSE'
app_1      | } { projection: {} }
app_1      | 2021-03-28T21:45:52.406Z engine intercepting request for path "/socket.io/"
app_1      | 2021-03-28T21:45:52.407Z engine handling "GET" http request "/socket.io/?EIO=3&transport=polling&sid=SIDSIDSIDSIDSIDSIDSI"
app_1      | 2021-03-28T21:45:52.408Z engine setting new request for existing client
app_1      | 2021-03-28T21:45:52.409Z engine:polling setting request
app_1      | 2021-03-28T21:45:52.436Z socket.io:socket socket connected - writing packet
app_1      | 2021-03-28T21:45:52.441Z socket.io:socket joining room SIDSIDSIDSIDSIDSIDSI
app_1      | 2021-03-28T21:45:52.442Z socket.io:client writing packet {"type":0,"nsp":"/"}
app_1      | 2021-03-28T21:45:52.442Z socket.io-parser encoding packet {"type":0,"nsp":"/"}
app_1      | 2021-03-28T21:45:52.442Z socket.io-parser encoded {"type":0,"nsp":"/"} as 0
app_1      | 2021-03-28T21:45:52.443Z engine:socket sending packet "message" (0)
app_1      | 2021-03-28T21:45:52.443Z engine:socket flushing buffer to transport
app_1      | 2021-03-28T21:45:52.444Z engine:polling writing "2:40"
app_1      | 2021-03-28T21:45:52.447Z socket.io:socket joining room xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
app_1      | 2021-03-28T21:45:52.448Z socket.io:socket joined room [ 'SIDSIDSIDSIDSIDSIDSI' ]
app_1      | 2021-03-28T21:45:52.450Z socket.io:socket joined room [ 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' ]
app_1      | 2021-03-28T21:45:52.452Z mquery findOne openhabs { uuid: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' } { projection: {} }
app_1      | 2021-03-28T21:45:52.457Z engine intercepting request for path "/socket.io/"
app_1      | 2021-03-28T21:45:52.458Z engine handling "GET" http request "/socket.io/?EIO=3&transport=polling&sid=SIDSIDSIDSIDSIDSIDSI"
app_1      | 2021-03-28T21:45:52.458Z engine setting new request for existing client
app_1      | 2021-03-28T21:45:52.458Z engine:polling setting request
app_1      | 2021-03-28T21:45:52.459Z engine:socket executing batch send callback
app_1      | 2021-03-28T21:45:52.460Z engine intercepting request for path "/socket.io/"
app_1      | 2021-03-28T21:45:52.461Z engine handling "GET" http request "/socket.io/?EIO=3&transport=websocket&sid=SIDSIDSIDSIDSIDSIDSI"
app_1      | 2021-03-28T21:45:52.461Z engine bad request: unexpected transport without upgrade
app_1      | 2021-03-28T21:45:52.509Z mquery findOne openhabs { _id: IDIDIDIDIDIDIDIDIDIDIDID } { session: undefined, projection: { _id: 1 } }
app_1      | 2021-03-28 23:45:51:5151 info: openHAB-cloud: express server listening on port 3000
app_1      | 2021-03-28 23:45:52:5252 info: openHAB-cloud: Successfully connected to mongodb
app_1      | 2021-03-28 23:45:52:5252 info: openHAB-cloud: Redis connect response: OK
app_1      | 2021-03-28 23:45:52:5252 info: openHAB-cloud: Redis is ready
app_1      | 2021-03-28 23:45:52:5252 info: openHAB-cloud: Authorizing incoming openHAB connection
app_1      | 2021-03-28 23:45:52:5252 info: openHAB-cloud: Incoming openHAB connection for uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
app_1      | 2021-03-28 23:45:52:5252 info: openHAB-cloud: Connected openHAB with xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx successfully
app_1      | 2021-03-28 23:45:52:5252 info: debug
app_1      | 2021-03-28 23:45:52:5252 info: openHAB-cloud: uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx server address undefined:undefined my address undefined:undefined
app_1      | 2021-03-28 23:45:52:5252 info: *** 2 ***
app_1      | 2021-03-28T21:45:53.287Z engine intercepting request for path "/socket.io/"
app_1      | 2021-03-28T21:45:53.287Z engine handling "POST" http request "/socket.io/?EIO=3&transport=polling&sid=SIDSIDSIDSIDSIDSIDSI"
app_1      | 2021-03-28T21:45:53.287Z engine setting new request for existing client
app_1      | 2021-03-28T21:45:53.294Z engine:polling received "76:42["itemupdate",{"itemName":"TVRoomStereoLamp_Brightness","itemStatus":"0"}]"
app_1      | 2021-03-28T21:45:53.295Z engine:socket packet
app_1      | 2021-03-28T21:45:53.297Z socket.io-parser decoded 2["itemupdate",{"itemName":"TVRoomStereoLamp_Brightness","itemStatus":"0"}] as {"type":2,"nsp":"/","data":["itemupdate",{"itemName":"TVRoomStereoLamp_Brightness","itemStatus":"0"}]}
app_1      | 2021-03-28T21:45:53.300Z socket.io:socket got packet {"type":2,"nsp":"/","data":["itemupdate",{"itemName":"TVRoomStereoLamp_Brightness","itemStatus":"0"}]}
app_1      | 2021-03-28T21:45:53.300Z socket.io:socket emitting event ["itemupdate",{"itemName":"TVRoomStereoLamp_Brightness","itemStatus":"0"}]
app_1      | 2021-03-28T21:45:53.301Z socket.io:socket dispatching an event ["itemupdate",{"itemName":"TVRoomStereoLamp_Brightness","itemStatus":"0"}]
app_1      | 2021-03-28 23:45:53:5353 info: [object Object]
app_1      | 2021-03-28T21:45:53.305Z engine intercepting request for path "/socket.io/"
app_1      | 2021-03-28T21:45:53.305Z engine handling "POST" http request "/socket.io/?EIO=3&transport=polling&sid=SIDSIDSIDSIDSIDSIDSI"
app_1      | 2021-03-28T21:45:53.306Z engine setting new request for existing client
app_1      | 2021-03-28T21:45:53.307Z engine:polling received "73:42["itemupdate",{"itemName":"TVRoomStereoLamp_Power","itemStatus":"OFF"}]"
app_1      | 2021-03-28T21:45:53.308Z engine:socket packet
app_1      | 2021-03-28T21:45:53.309Z socket.io-parser decoded 2["itemupdate",{"itemName":"TVRoomStereoLamp_Power","itemStatus":"OFF"}] as {"type":2,"nsp":"/","data":["itemupdate",{"itemName":"TVRoomStereoLamp_Power","itemStatus":"OFF"}]}
app_1      | 2021-03-28T21:45:53.310Z socket.io:socket got packet {"type":2,"nsp":"/","data":["itemupdate",{"itemName":"TVRoomStereoLamp_Power","itemStatus":"OFF"}]}
app_1      | 2021-03-28T21:45:53.311Z socket.io:socket emitting event ["itemupdate",{"itemName":"TVRoomStereoLamp_Power","itemStatus":"OFF"}]
app_1      | 2021-03-28T21:45:53.312Z socket.io:socket dispatching an event ["itemupdate",{"itemName":"TVRoomStereoLamp_Power","itemStatus":"OFF"}]
app_1      | 2021-03-28 23:45:53:5353 info: [object Object]
app_1      | 2021-03-28T21:46:02.290Z engine intercepting request for path "/socket.io/"
app_1      | 2021-03-28T21:46:02.291Z engine handling "POST" http request "/socket.io/?EIO=3&transport=polling&sid=SIDSIDSIDSIDSIDSIDSI"
app_1      | 2021-03-28T21:46:02.292Z engine setting new request for existing client
app_1      | 2021-03-28T21:46:02.293Z engine:polling received "71:42["itemupdate",{"itemName":"OutsideLights_Switch","itemStatus":"OFF"}]"
app_1      | 2021-03-28T21:46:02.293Z engine:socket packet
app_1      | 2021-03-28T21:46:02.294Z socket.io-parser decoded 2["itemupdate",{"itemName":"OutsideLights_Switch","itemStatus":"OFF"}] as {"type":2,"nsp":"/","data":["itemupdate",{"itemName":"OutsideLights_Switch","itemStatus":"OFF"}]}
app_1      | 2021-03-28T21:46:02.295Z socket.io:socket got packet {"type":2,"nsp":"/","data":["itemupdate",{"itemName":"OutsideLights_Switch","itemStatus":"OFF"}]}
app_1      | 2021-03-28T21:46:02.296Z socket.io:socket emitting event ["itemupdate",{"itemName":"OutsideLights_Switch","itemStatus":"OFF"}]
app_1      | 2021-03-28T21:46:02.296Z socket.io:socket dispatching an event ["itemupdate",{"itemName":"OutsideLights_Switch","itemStatus":"OFF"}]
app_1      | 2021-03-28 23:46:02:022 info: [object Object]
app_1      | 2021-03-28T21:46:02.468Z engine intercepting request for path "/socket.io/"
app_1      | 2021-03-28T21:46:02.469Z engine handling "POST" http request "/socket.io/?EIO=3&transport=polling&sid=SIDSIDSIDSIDSIDSIDSI"
app_1      | 2021-03-28T21:46:02.470Z engine setting new request for existing client
app_1      | 2021-03-28T21:46:02.471Z engine:polling received "1:1"
app_1      | 2021-03-28T21:46:02.471Z engine:polling got xhr close packet
app_1      | 2021-03-28T21:46:02.472Z engine:polling writing "1:6"
app_1      | 2021-03-28T21:46:02.476Z socket.io:client client close with reason transport close
app_1      | 2021-03-28T21:46:02.477Z socket.io:socket closing socket - reason transport close
app_1      | 2021-03-28T21:46:02.481Z mquery findOne openhabs { _id: IDIDIDIDIDIDIDIDIDIDIDID } { projection: {} }
app_1      | 2021-03-28 23:46:02:022 info: openHAB-cloud: Disconnected xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Surely someone can see something I can’t or I don’t understand. If I get it correctly, connections to the cloud server from a domain that is NOT “home." should route to the login/registration stuff, and connections to the cloud server from a "home.” domain should be routed to the openHab server – somehow…I assume through the connection it made with cloud server.

What else can I say? If anyone has ANY ideas, please comment.

Addendum:
I tore everything down and rebuilt it (on the cloud server side), and the connection still drops and reconnects just like before, but my openhab server is marked as online. Clicking to view my dashboard now asks me to log in using basic authentication (browser authentication dialog)…it doesn’t accept any name/password that I understand. Why does THAT happen?

Just to be complete, here’s the debug dump from the org.openhab.io.openhabcloud side:

2021-03-28 16:26:20.670 [DEBUG] [io.openhabcloud.internal.CloudClient] - No connection, Item update is not sent
2021-03-28 16:26:20.672 [DEBUG] [io.openhabcloud.internal.CloudClient] - No connection, Item update is not sent
2021-03-28 16:26:21.019 [DEBUG] [io.openhabcloud.internal.CloudClient] - Socket.IO connected
2021-03-28 16:26:21.020 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)
2021-03-28 16:26:21.283 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sending update '0' for item 'TVRoomTableLamp_Brightness'
2021-03-28 16:26:21.285 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sending update 'OFF' for item 'TVRoomTableLamp_Power'
2021-03-28 16:26:28.271 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sending update '0' for item 'LivingRoomFloorLamp_Brightness'
2021-03-28 16:26:28.273 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sending update 'OFF' for item 'LivingRoomFloorLamp_Power'
2021-03-28 16:26:30.187 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sending update '0' for item 'TVRoomStereoLamp_Brightness'
2021-03-28 16:26:30.190 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sending update 'OFF' for item 'TVRoomStereoLamp_Power'
2021-03-28 16:26:31.028 [ERROR] [io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance: {}
io.socket.engineio.client.EngineIOException: xhr poll error
	at io.socket.engineio.client.Transport.onError(Transport.java:63) [bundleFile:?]
	at io.socket.engineio.client.transports.PollingXHR.access$100(PollingXHR.java:26) [bundleFile:?]
	at io.socket.engineio.client.transports.PollingXHR$6$1.run(PollingXHR.java:140) [bundleFile:?]
	at io.socket.thread.EventThread$2.run(EventThread.java:80) [bundleFile:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.net.SocketTimeoutException: timeout
	at okio.Okio$4.newTimeoutException(Okio.java:230) ~[?:?]
	at okio.AsyncTimeout.exit(AsyncTimeout.java:285) ~[?:?]
	at okio.AsyncTimeout$2.read(AsyncTimeout.java:241) ~[?:?]
	at okio.RealBufferedSource.indexOf(RealBufferedSource.java:345) ~[?:?]
	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:217) ~[?:?]
	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:211) ~[?:?]
	at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189) ~[?:?]
	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:75) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[?:?]
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[?:?]
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[?:?]
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) ~[?:?]
	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) ~[?:?]
	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) ~[?:?]
	... 3 more
Caused by: javax.net.ssl.SSLException: Socket closed
	at sun.security.ssl.Alert.createSSLException(Alert.java:127) ~[?:?]
	at sun.security.ssl.TransportContext.fatal(TransportContext.java:349) ~[?:?]
	at sun.security.ssl.TransportContext.fatal(TransportContext.java:292) ~[?:?]
	at sun.security.ssl.TransportContext.fatal(TransportContext.java:287) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1581) ~[?:?]
	at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:979) ~[?:?]
	at okio.Okio$2.read(Okio.java:139) ~[?:?]
	at okio.AsyncTimeout$2.read(AsyncTimeout.java:237) ~[?:?]
	at okio.RealBufferedSource.indexOf(RealBufferedSource.java:345) ~[?:?]
	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:217) ~[?:?]
	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:211) ~[?:?]
	at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189) ~[?:?]
	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:75) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[?:?]
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[?:?]
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[?:?]
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) ~[?:?]
	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) ~[?:?]
	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) ~[?:?]
	... 3 more
Caused by: java.net.SocketException: Socket closed
	at java.net.SocketInputStream.read(SocketInputStream.java:183) ~[?:?]
	at java.net.SocketInputStream.read(SocketInputStream.java:140) ~[?:?]
	at sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478) ~[?:?]
	at sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472) ~[?:?]
	at sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1354) ~[?:?]
	at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:963) ~[?:?]
	at okio.Okio$2.read(Okio.java:139) ~[?:?]
	at okio.AsyncTimeout$2.read(AsyncTimeout.java:237) ~[?:?]
	at okio.RealBufferedSource.indexOf(RealBufferedSource.java:345) ~[?:?]
	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:217) ~[?:?]
	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:211) ~[?:?]
	at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189) ~[?:?]
	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:75) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[?:?]
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[?:?]
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) ~[?:?]
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) ~[?:?]
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) ~[?:?]
	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) ~[?:?]
	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) ~[?:?]
	... 3 more
2021-03-28 16:26:31.055 [DEBUG] [io.openhabcloud.internal.CloudClient] - Socket.IO disconnected
2021-03-28 16:26:31.058 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, base URL = http://localhost:8080)

Just for furture people looking - the trouble seemed to be the connection between the OpenHABian instance to the cloud server through the firewall. No idea why, it should have worked fine.

I change the OpenHab Cloud Client to connect directly to the webserver port 3000 (All internal) and everything seems to be working.

I had a similar issue and I managed to resolve it by pinging the websocket connection more frequently so it doesn’t close the session by adding these two parameters to app.js -

var io = require('socket.io')(server, {
    logger: logger, 'pingTimeout': 18000, 'pingInterval': 6000
});

from this

var io = require('socket.io')(server, {
    logger: logger
});

Thanks @FreezerBurnt could you please give a breakdown of how this was achieved for us not so clever peeps, I have the same issue on a daily basis.

All I really did for this issue was, in the OpenHab, openHAB Cloud settings, set the cloud instance to “:3000” where the is the local IP of my server running the cloud instance.

I HAD been trying to connect using “home.:443” which I had forwarded to the cloud server at my firewall. It should have worked fine but didn’t.

Since then, I have abandon running my own openHAB cloud server. The main problem I ran into is that in the mobile app, it would work properly from inside my WiFi (local server) but when it went to the remote server it would ALWAYS ask me to log in and it became really annoying. So, I just moved back to myopenhab.org for now.

When I get some time in the future I might retry making my own cloud server, but the directions were really hard to follow and I kept having to make code tweaks to make it work.

Maybe if someone came up with really good tutorial on how to set up a personal cloud server it would be great.

1 Like

Sorry to hear that you didn’t get any responses to your previous posts. I think the vast majority of OH users either use myopenhab or a reverse proxy, both of which are easier to set up and maintain than a personal cloud server.

The best way to write a tutorial is to document as you carry out the task. But as you’ve noted, there are so many pitfalls to this particular task that it would be hard to capture succinctly. And then you have to maintain and update the tutorial, and be ready/willing to answer questions from all the people who try to use it. Otherwise, the tutorial quickly becomes useless.

If someone is 100% against using myopenhab then I’d suggest they set up reverse proxy and use Telegram for notifications before I suggest setting up a personal cloud.

I was actually pretty close, but didn’t have enough spare time to get it finished. myopenhab has been working fine for me, so I have no qualms using it!

As for a tutorial, I was of half a mind to start at the beginning again, and write down everything I did or discovered along the way - as well as actually learning how the server works. If I every get some spare time again, maybe I’ll give it a go.

Thanks for the reply though, it might help someone else avoid getting in over their head!

1 Like

Thanks @FreezerBurnt
I removed the :443 as per another users suggestion and that seems to work quite well, for now I do not want to setup my own cloud server. My real issue is the disconnection from the cloud every 24 or so hours, Just updated Java so hopefully that will fix the issue.