I’m pretty sure I have found the error in the cloud connector code. There was a hack fixing problems with low latency to the openhab server but it was lost in a rewrite that fits the timing of when problems started. I have created a kar file but I am struggling with the installation - it works after copying to the addons folder but it doesn’t work after a restart of openhab.
/**
* What is this? In some cases where latency is very low the myopenhab service
* can receive responseFinished before the headers or content are received and I
* cannot find another workaround to prevent it.
*/
ThreadPoolManager.getScheduledPool(THREADPOOL_OPENHABCLOUD).schedule(() -> {
JSONObject responseJson = new JSONObject();
try {
responseJson.put("id", mRequestId);
socket.emit("responseFinished", responseJson);
logger.debug("Finished responding to request {}", mRequestId);
} catch (JSONException e) {
logger.debug("{}", e.getMessage());
}
}, 1, TimeUnit.MILLISECONDS);
I’m now on OpenHAB 4.0.1 and I still struggle with that opening https://home.myopenhab.org in my browser shows a blank page and that openHAB Android App 3.0.3 shows no sitemaps when connected to remote server. (Error: “openHAB returned an empty Sitemap list”)
OpenHAB log says: Connected to the openHAB Cloud service (UUID = 0d...e1, base URL = http://localhost:8080)
I can access the page https://home.myopenhab.org/ and I can also access all the pages found in the menu bar.
Maybe it’s irrelevant but if I enter https://myopenhab.org/basicui/app I get a list of my site maps with links to my different site maps. Images on those site maps shows up as broken links.
Using the browser opening https://home.myopenhab.org I can see in the console that there are ERR_CONTENT_LENGTH_MISMATCH.
Something is obviously wrong but unfortunately I can’t figure out what it is.
Yeah this still doesn’t work. Been an issue for many many OpenHAB iterations now. I’m now running latest stable OpenHAB 4.0.2? This has been ongoing for ~2+ years now.
App shows “openHAB returned empty sitemap list” when connecting from external network.
Works fine with Google Assistant so the cloud connector is obviously running…
Log from the app. Note that end of input seems to be character 0 (i.e no data returned).
“End of input at character 0”
09-01 14:46:08.155 17960 18026 E ServerProperties: Failed parsing sitemap JSON
09-01 14:46:08.155 17960 18026 E ServerProperties: org.json.JSONException: End of input at character 0 of
Full log
09-01 14:46:08.151 17960 2752 I okhttp.OkHttpClient: <-- 200 OK https://myopenhab.org/rest/sitemaps (179ms)
09-01 14:46:08.151 17960 2752 I okhttp.OkHttpClient: Server: nginx/1.18.0 (Ubuntu)
09-01 14:46:08.151 17960 2752 I okhttp.OkHttpClient: Date: Fri, 01 Sep 2023 12:46:06 GMT
09-01 14:46:08.151 17960 2752 I okhttp.OkHttpClient: Content-Length: 0
09-01 14:46:08.152 17960 2752 I okhttp.OkHttpClient: Connection: keep-alive
09-01 14:46:08.152 17960 2752 I okhttp.OkHttpClient: X-Powered-By: Express
09-01 14:46:08.152 17960 2752 I okhttp.OkHttpClient: Set-Cookie: ██
09-01 14:46:08.152 17960 2752 I okhttp.OkHttpClient: Set-Cookie: ██
09-01 14:46:08.152 17960 2752 I okhttp.OkHttpClient: <-- END HTTP
09-01 14:46:08.155 17960 18026 E ServerProperties: Failed parsing sitemap JSON
09-01 14:46:08.155 17960 18026 E ServerProperties: org.json.JSONException: End of input at character 0 of
09-01 14:46:08.155 17960 18026 E ServerProperties: at org.json.JSONTokener.syntaxError(JSONTokener.java:460)
09-01 14:46:08.155 17960 18026 E ServerProperties: at org.json.JSONTokener.nextValue(JSONTokener.java:101)
09-01 14:46:08.155 17960 18026 E ServerProperties: at org.json.JSONArray.<init>(JSONArray.java:94)
09-01 14:46:08.155 17960 18026 E ServerProperties: at org.json.JSONArray.<init>(JSONArray.java:110)
09-01 14:46:08.155 17960 18026 E ServerProperties: at org.openhab.habdroid.model.ServerProperties$Companion.loadSitemapsFromJson(Unknown Source:2)
09-01 14:46:08.155 17960 18026 E ServerProperties: at org.openhab.habdroid.model.ServerProperties$Companion.fetchSitemaps(Unknown Source:131)
09-01 14:46:08.155 17960 18026 E ServerProperties: at org.openhab.habdroid.model.ServerProperties$Companion.access$fetchSitemaps(Unknown Source:0)
09-01 14:46:08.155 17960 18026 E ServerProperties: at org.openhab.habdroid.model.ServerProperties$Companion$fetchSitemaps$1.invokeSuspend(Unknown Source:13)
09-01 14:46:08.155 17960 18026 E ServerProperties: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
09-01 14:46:08.155 17960 18026 E ServerProperties: at kotlinx.coroutines.DispatchedTask.run(Unknown Source:88)
09-01 14:46:08.155 17960 18026 E ServerProperties: at kotlinx.coroutines.internal.LimitedDispatcher.run(Unknown Source:12)
09-01 14:46:08.155 17960 18026 E ServerProperties: at kotlinx.coroutines.scheduling.TaskImpl.run(Unknown Source:2)
09-01 14:46:08.155 17960 18026 E ServerProperties: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(Unknown Source:0)
09-01 14:46:08.155 17960 18026 E ServerProperties: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(Unknown Source:14)
09-01 14:46:08.155 17960 18026 E ServerProperties: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(Unknown Source:28)
09-01 14:46:08.155 17960 18026 E ServerProperties: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:0)
09-01 14:46:08.155 17960 18026 D ServerProperties: Server returned sitemaps: []
09-01 14:46:08.156 17960 17960 E MainActivity: openHAB returned empty Sitemap list
Update
In fact I got it to work by completely spamming the retry button in the app until the sitemap appeared. https://home.myopenhab.org/rest/sitemaps seems to only return data randomly some of the time and for some reason spamming F5 in the browser or retry button in the app gets it to cooperate… But then it still spams “Event subscription failed” and doesn’t work completely. Sketchy.
Thanks @Masssssy for the info. It certainly feels good not to be the only user experiencing those problems. Do you happen to know if there is an open GitHub issue for this?
Basically I have had this issue for 2 years. @andreasbrinch thought he found the issue as stated in the post from Jan 15. If I recall correctly that fix was going in somehow or have I dreamt about that commit on Github? The reason I again revisit this thread is because I updated to openHAB 4 a few days ago and the issue is still there. Was hoping it would’ve been fixed.
So, in short, I have had problem for ~2 years. Thought it was fixed. Still doesn’t work in OpenHAB 4. Can’t figure out why. Seems to affect some people, but obviously far from all.
@andreasbrinch, did you every fully verify your proposed fix from above? If so, did someone ever create a pull request for the fix?
Have yiu tried the solution of removing language settings in OH. Clearvtge Android App cache etc.
That worked for me.
Issue came back after a few months.
Repeated and been fine since then.
Can set OH language back after and still works.
Because an alledged fix of the issue was posted 9 months ago, between latest OpenHAB3 and the release of OpenHAB 4. If you read the thread and literally my latest post you can see that we get blank responses from the API even on our desktop browsers. Sure it might work on your iPhone because your OH instance is all good, but I bet you that your iPhone app wouldn’t work on my OH instance.
Also, various strange fixes have been reported working. E.g for a while it worked to set the OH logging to debug which would probably indicate that there is some sync/race condition issue or similar. Slowing down the application by logging heavily shouldn’t (in a working, bug free scenario) fix, or for that matter cause that major issues. People have also reported it to work when changing locales back and forth and what not.
What do you mean by removing language? Could you explain in better detail?
Still most of the time getting blank responses from the following link so it is not an issue with the app. The app just happens to use this API call probably. https://home.myopenhab.org/rest/sitemaps
This, from my point of view, proofs it is not an openHAB issue, but looks like an Android App issue.
Local REST Api call to endpoint /sitemaps is working, but remote call to same endpoint does not work. As it is the same Api and same endpoint, issue must be somewhere else.
How is this remotely any proof that the app is the issue? The is most likely in the openhab cloud connector or in myopenhab.org itself.
While it might be the same “endpoint”, the remote one takes completely other paths through networks and servers which could easily mess things up and not forward it properly.
I would like to confirm that neither the procedure involving changing the Regional Settings Language to “nothing” in the OH Settings nor the procedure of setting the OH logging to debug appears to be effecting any changes in my current situation.
Regarding the issue with the web page https://home.myopenhab.org/rest/sitemaps consistently resulting in a blank page when accessed through various browsers and locations (all of which have been tested), it seems reasonable to temporarily exclude the OpenHAB App from our troubleshooting efforts.
Hi, has anybody a solution for this problem?
I have the still same problems as @Masssssy
It works within local network, but not with myopenhab.org, I got still blank pages within the webbrowser and different error messages within the browser console