I have my openhab running with docker and hosted on my raspberry, working perfectly and reachable via the browser and through my openhab org account but there is no way I can access to it with the Android App.
Neither the local nor the remote address (my openhab org) with credentials seems to make the job from the App.
What I have tried with so far…
server settings:
local → http: 192.xxxxxxx:8480 (yes, I have my local instance exposed at 8480) + cred
local → https: 192.xxxxxxx:8443 + cred
remote → my open hab org account + cred
The same urls are reachable from my Android without any issue.
Clear cache and all remaining data, reinstall App, no progress…
Any clue, because I cannot get why the app is stuck.
Just to be clear, you cannot configure the android app to connect to the OH server at all, or the app simply cannot automatically find it?
Do you have a reverse proxy set up that provides basic auth or have you configured OH to usebasic auth or an API token?
Don’t confuse the credentials you use to access OH with the credentials used to assume a role once the connection to OH is established. Which credentials are you using?
Typically with a default configuration there are no credentials at all for the local connection.
The App cannot find it, neither local, nor remote.
Now I am far away from my local raspi, so I can only access remotely via myopenhab.org.
OH runs with docker, so the auth is the native one coming with the OH image (and YES there is also a local user+pwd for access).
bb4eeb7d8765 openhab/openhab:4.3.4 “/entrypoint gosu op…” 3 weeks ago Up 8 days (healthy) 5007/tcp, 8101/tcp, 0.0.0.0:8443->8443/tcp, \[::\]:8443->8443/tcp, 0.0.0.0:8480->8080/tcp, \[::\]:8480->8080/tcp openhab
cd252614559e koenkk/zigbee2mqtt “docker-entrypoint.s…” 3 weeks ago Up 8 days 0.0.0.0:8080->8080/tcp, \[::\]:8080->8080/tcp zigbee2mqtt
cd3c271ba844 postgres:15.12 “docker-entrypoint.s…” 3 weeks ago Up 8 days 0.0.0.0:5432->5432/tcp, \[::\]:5432->5432/tcp openhab_postgresql
666044eb4fbb eclipse-mosquitto “/docker-entrypoint.…” 3 weeks ago Up 8 days 0.0.0.0:1883->1883/tcp, \[::\]:1883->1883/tcp, 0.0.0.0:9001->9001/tcp, \[::\]:9001->9001/tcp mqtt
Did you disable the implicit user role? Did you enable basic auth? By default, OH does not require any credentials, and you should not enter any for the local connection.
Again, don’t confuse credentials that OH asks for to assume the admin role with the credentials the Android app requires to access OH in the first place.
If you open the UI in the browser, are you presented with a auth dialog before anything on the page is rendered? Then you do have basic auth enabled and you must enter those credentials. But if you can access MainUI from a browser but need to click on the shield icon in the bottom left to access the Settings, you do not have basic auth and you should not enter any credentials for the local connection.
Most users leave the credentials blank for the local connection because they run with the default settings.
Running in Docker is irrelevant. This is true for any OH installation.
For the remote connection through the openHAB Cloud Server, you use https://myopenhab.org/ as the URL and the credentials you use to log in to myopenhab.org as the username and password.
Depending on your API Security settings previously mentioned, you may need to provide additional credentials to access MainUI itself. But by default the implicit user role is enabled so you’d only need to enter additional credentials to access the settings.
Again: local credentials are left blank in my case. So letting the “local” auth aside, it does not affect at all the remote cloud access via the myopenhab.org (where I can access to my mainUI without problem) or am I wrong? Where is the problem then?
You are not home so your phone is not on your LAN.
The local connection will only be used when you are on your LAN.
If I’m misunderstanding, and you are home and your phone is on the LAN and it’s still not working, all I can think of is you are not using a standard Docker run command as described in the docs. The recommended and supported approach is to use net=host rather than exposing each and every port individually. There are lots of reasons for this, not least of which includes some individual add-ons will open additional ports, network discovery won’t work, some add-ons require IPv6, etc.
You can try going to Settings → Network Settings and make sure that the Primary Address and Broadcast Address seem reasonable. If it’s pointing to a 172.x.x.x IP range your OH might not be listening for incoming connection in the right place. Though I wouldn’t expect it to work using a browser in that case either.
sorry for the quality, somehow my VNC client does not permit screenshot somehow. But if I follow your reasoning right, the fact that I can access to my mainUI via myopenhab.org is the proof that nothing should collide with regards to the well-functioning of the App, right?
The connection through myopenhab.org and the local connection are completely unrelated in the app.
The app tries to connect using the local configuration first and when that fails it uses the remote connection. They are mutually exclusive. The fact that the remote connection works has nothing to do with whether the local connection will work.
Once connected the app doesn’t behave any different whether the connection is remote or not.
If the local connection doesn’t work it means there is something networking wise that is preventing that connection.
Given your Docker run connection, the app won’t be able to discover openHAB on the network because it uses a broadcast message asking “any OH servers on this network?”. As far as OH is concerned, it’s not on your LAN so it won’t see that broadcast message and therefore won’t respond.
There’s another reason to use net=host instead of exposing ports individually.
However, if you put in the URL and port into the local connection same as you’d use in the browser (don’t forget the training /, for example https://192.168.1.123:8443/) the app should be able to connect. If it’s not, that means there is something network wise that preventing the connection. What can that be?
You have a non-standard Docker deployment. I presume there’s a VPN involved. There could be lots of stuff preventing the connection.
Thank you for all the explanation, I am trying to understand but I am a bit lost now…
Since my raspi is 1100km from there, I cannot test the App with the local setup, I got it 100%, no LAN, no local setup. Therefore I am giving a try only with the cloud now.
But what I do not get is:
If the remote setup involves ONLY the cloud creds, this is all that matters for access, right? Nothing to do with the local setup, standardized to some docker clis or am I wrong?
BTW, I am using docker-compose so the deployment is pretty straight forward.
If you are suggesting that the local deployment setup has an impact on the cloud connection (e.g cloud connection okay + local setup not standardized = broken App), then I did not understand at all what is going on…
But you’ve said that the remote connection works. And if you have no VPN or anything like that set up the local connection isn’t irrelevant. The only connection you can use and test is working.
Guess what! I decided to uninstall the App but this time I erased all the openhab data that were stored on my phone and bam, it is working!!! I am pretty sure I did that exact same thing when I was on LAN 3 weeks ago but could not figure out why it did not work. So yeah, fresh install with no dataleft made the deal. Thank you @rlkoshak for the support, sometimes confirming the irrational can also help!