A long delay when accessing openHAB through Android

I have some issue when I tried to access openHAB through Android. There is like a 10 second delay everytime I tried to enter a group. I am only facing this issue on Android (tried it on 4 different Android phones), as it is working fine on iOs.

I have seen something regarding the slow loading related to https protocol, but in my case I am only using http protocol, so it is definitely not related to the protocol.

Do you have any idea how to solve this issue?


What version of OH are you using? What is it running on? I had seen this issue with OH2 where the server would run out of threads to serve the request, but that has since been remedied. Are there any images or assets being loaded in this group ?

I am using one OH 1.8.2 and one OH 1.8.3. Both of them are running on Raspberry Pi with Raspbian Wheezy OS. The Raspberry Pi also acts as the wireless access point. There is no image or asset loaded into the group. It is just a standard group where all lamps are put into one group, all sensors are put into another group, etc.

What Raspberry pie model (1, 2 or 3) is it? When the android client is spinning, what is the CPU load on the server? Are then any messages in the log at that time. Are you familiar at all with the logcat utility to see logging on your android device?

It is Raspberry Pi 2 Model B. When the android client was spinning, the CPU load on the server was less than 10% and the memory consumption was only around 150MB. I am not familiar with the logcat utility, but I will look into it and post the logging of the android device here once I know how to do so.

I really like Raspberry Pis, but IMHO even the Raspberry Pi 3 is underpowered when it comes to openHAB. I think that a lot of it has to do with the limited memory of the Raspberry Pi and definitely the poor I/O.

I personally would find a local recycled computer reseller and pick up an old PC. At the reseller that I shop at I can usually get a 2-4 core system with 4G of RAM with no operating system for $75 or so. Swap out the HDD that came with the system for a SSD (you don’t need a very large or fast one so they don’t cost a lot), install your favourite Linux distro on it and you’ll have a system that will run circles around the Raspberry Pi.

There have been a lot of forum threads about what hardware to use as well so check those out as well.

As I am not that familiar with the logcat utility, I am not 100% sure whether the log that I saw is correct or not (using adb). But there is no error related to openHAB, the log simply said “openHAB version 1” everytime the devices opened openHAB application for the first time.

To isolate the issue even further, this delay only occurred when Raspberry Pi was not connected to internet. So it basically only happened when Raspberry Pi acted as an intranet server. But this problem is not happened at all on iOs devices, dekstop/laptop, and even web browsers on Android devices.

Then the issue is simply related to openHAB application on Android devices. Bug?

Thank you for the input. I will look into your suggestion.

But for the time being, I guess switching lights on/off through motion sensors is still manageable for Raspberry Pi (based on RAM consumption of only around ~200MB so far). And it is working fine with openHAB application on iOs devices, dekstop/laptop and even web browser on Android devices.

I’m not expecting an error, but it would be helpful to see what is printed right before, during and then when the group is finally displayed. I would like to know if its a hung connection, if its retying, ect…

This sounds like its going to be tough to debug then, hopefully something in the log file can be helpful.

I have run two separate logcat command. Here is the log file from one Android device:

—> When Raspberry Pi only acted as an intranet. I tried to 9 different groups, and every single of them had a delay of around 10 seconds.

—> When Raspberry Pi connected to internet. I did the same thing, and none of them had a delay at all.

So if i’m reading the first log correctly, it looks like your phone’s internet connection is going up and down between each request with this message:
I/NetworkDiagnostics_CheckStateManager( 1414): networkBlocked
there is something very not right about it, you can see other apps also disconnecting and reconnecting. There’s also this “XiaomiFirewall” message that specifically calls out the openhab app. Something seems to be stopping networking for a while, not sure if its the networking on the pi or the phone.

Here on my first project, I simply want to implement a home automation without internet connection at all. Basically it operates on intranet basis only, where Raspberry Pi acts as the intranet server. The phones then connected to Raspberry Pi through wireless connection. While doing so, the phones will automatically lose internet connection also. This might be the reason behind the networking problem you mentioned before.

Anyway, here is another log from another Android device:
https://drive.google.com/open?id=0Bya2bkHAr-MDQ0oyYnRjWkdRbm8 <— Raspberry Pi as an intranet server
https://drive.google.com/open?id=0Bya2bkHAr-MDTm1lUGhQUkFvOEU <— Raspberry Pi connected to internet
Note: I have also tried it on two Samsung devices, but I have no luck when I tried to connect it to adb on my computer. Hence I could not get any log from those two devices, but the issue is basically the same.

Then I am really puzzled how could openHAB application works perfectly fine on iOs devices under the same situation? I am googling through the internet and I found that iOs devices implement MultiPath TCP since iOs 7, where it basically allow cellular network and wifi network works together. While on the other hand, Android devices are far behind. Could this be the reason and practically makes openHAB application on Android unusable without internet from wireless connection?

I also have no idea why and android devices might have issue, could it be possible when connecting to your PI the android is not getting a proper DNS server, or default route? Maybe IOS handles this differently? Hard to know for sure.

I have noticed quite a delay on my Android devices (doesn’t exist at all on the PC side of things when I use that interface) and it seems to have crept up about the time of the last Android store update.

I have no idea really. Then, I should just use the web browser to access openhab through the intranet server.

Thank you very much for the time to help me assessing the issue.