Android app connection to windows fails

Tags: #<Tag:0x00007f61847c0320> #<Tag:0x00007f61847c01b8>

I am new and experimenting with OpenHAB (2.5.3). I am using my Windows 8.1 desktop before attempting a more definitive Raspberry implementation. So far so good. But when trying the android app it cannot connect with the local server on my windows system. The autodetection in the app does find my computer’s IP (http://192…:8080) but gives the error “Connection to local server failed”.
I tried the obvious: disable Windows firewall for private access, enable remote access, but nothing helps. I am not a Windows nor networking guru and cannot find anything in the documentation - what more can I try?
Is it necessary to install OpenHab as a Windows service for this? (I didn’t bother doing it since only experimenting before deciding to go on with OpenHAB)

Try the Beta version of Android app.

No, beta still doesn’t work. The autodetection now tried https://192…:8443 but no success. Next I changed it manually to http://192…:8080 but still no success. Probably some Windows/network setting is blocking the access?

Maybe? Not a Windows user so not much to recommend.

What if

  • you use a browser on your smartphone/tab and use a browser to connect ? does that work ?

If it works there is nothing in between.
If it does not work open a browser on the same windows system to access the URL.
Does that work ?

No, using a browser on my android device doesn’t work either. On my Windows computer I used a browser from the start to setup a small system with PaperUI and BasicUI, this works perfectly (using http port 8080, and using https port 8443 also works).

As you may need elevated rights open a command box ( cmd ) with admin rights and run the command

netstat -a -b

Check for the ports you mentioned ( 8080, 8443 ).
These ports need to be listed as listening ports.
The related IP address is it your ( Windows ) computers IP address or is it ( the local interface ) ?

Here is the list after filtering the relevant ports 8080 and 8443:

TCP client:49657 ESTABLISHED

TCP [::]:8080 Peacock:0 LISTENING
TCP [::]:8443 Peacock:0 LISTENING
TCP 192.168.xx.xx:8443 Peacock:52133 ESTABLISHED
TCP 192.168.xx.xx:8443 Peacock:59143 ESTABLISHED
TCP 192.168.xx.xx:52133 Peacock:8443 ESTABLISHED
TCP 192.168.xx.xx:59143 Peacock:8443 ESTABLISHED

I assume the established connections in the list are the browser PaperUI and BasicUI instances that are active on my computer (I use https although it works just as well with http on my computer). The other entries are harder to interprete for me. ‘Peacock’ is my computer’s name and I am using the firefox browser. ‘Code.exe’ is probably Visual Studio Code which is also active currently.

Yes, the related address is the computer’s IP address which I use for my computer’s browser and that I also try to use from the android app.

(I 'xx’ed some parts of the IP address: although it is a local address I am always wary to give too much info on a public site - better safe than sorry :slight_smile:

I tried using on my windows computer browser and that also works.

Is your android device in the same LAN / same IP range ?
You also tried to temp. disable firewalls and antivirus software ?
In windows network settings you can define if your PC is member of a public network or private network. What is the current setting ?

Yes, the IP range is the same. My network settings show a public network (a VPN connection to the internet) and a private network (local, no internet access). In the advanced sharing settings for the private profile, network discovery is enabled. I also enabled network discovery for the guest or public profile.
Strangely enough, at some point in time and after changing a few settings in the advanced network settings, I suddenly could connect and saw my basicUI on the android device. I then started reverting the changed settings one by one and retrying to start the app to find out what change is minimally required. I could undo all changes except the firewall: switching it on prohibited the app from logging on. I next allowed Zulu to pass the firewall for private access and re-enabled the firewall. The app could then again connect with the computer.
However, something felt awkward, so I restarted both the android device and my computer. After that the app again couldn’t connect anymore. I again changed all settings I previously changed, but I haven’t been able to connect again anymore.
It appears to me that (except for the firewall) not much settings need to be changed but that the problem is something else, some sort of time-out preventing it to connect and I was very lucky just once?
Also strange is that after the first successful connection, the app kept connecting easily while I was reverting (I stopped the app from running in the background after every try). As if both devices now knew about each other (some data in a cache?) that was reset after the restart.
You know about some freeware network analysis tools that could help? Or maybe you have some other suggestions?
Thanks a lot for your help.

For network analysis I usually use wireshark on Linux as well as on Windows. For windows there is even a portable version.

Yesterday evening I tried again, this time with the VPN of my android device turned off. The app again could make the connection. Next I tried it with VPN on again - same result: connected.
So this morning I decided to restart both computer and android device once more, and I cleared the app’s data and cache as well. My computer’s only setting that remains changed since I started the app experiment is the Zulu application that is allowed private network access so that I can keep the local firewall turned on.
No problem, the app connected again. I had noticed it tried the https and port 8443 when first started and after failing I always changed it to http and port 8080.
But this morning the app gave a warning that there is no certificate for the https, and when I allowed it anyway the app connected using https with no problem.
So the issue seems to be gone (I had no clue why, until I noticed the app had an update at 23/6 - some angel did some fixes lately?)
Anyway, thanks everyone for helping and it convinces me to continue with OpenHAB