openhab / openhab-android

openHAB client for Android
https://play.google.com/store/apps/details?id=org.openhab.habdroid
Eclipse Public License 2.0
600 stars 315 forks source link

Skipping local connections, when WiFi name cannot be read #3414

Open dilyanpalauzov opened 1 year ago

dilyanpalauzov commented 1 year ago

I have set up in the Local connections “Restrict access to these Wi-Fi networks”.

I do not understand what is the purpose of the “Restrict” toggle - if there are network names, then openHAB-Android shall use the local connection, only if the WiFi networks have one of the provided names. Just the presence of any Wi-Fi network name implies restrcting connections to these names.

Apart from this, if the Location service is turned globally off, the applications cannot read the names of the Wi-Fi networks. In these cases openhab-Android does not try to connect to the local connections and uses the global connection.

I think, when openhab-Android does not know the names of the WiFi networks, then it shall use try the local connection.

mueller-ma commented 1 year ago

Entering a SSID makes the app switch the primary server when you connect to a specified Wi-Fi. There might be cases where servers are reachable over multiple SSIDs, e.g. router with 2.4 and 5 GHz with different names or two houses being connected over VPN.

I think, when openhab-Android does not know the names of the WiFi networks, then it shall use try the local connection.

That could lead to a connection to a wrong (not-openhab) server, especially since local IP addresses aren't unique.

dilyanpalauzov commented 1 year ago

My understand of this function is, that it works as speed-up. If the application knows that in the current WLAN, based on its name, it cannot connect to the local instance, it does not try to the local system, and connects faster to the remove address.

If the application does not know the name of the Wi-Fi network, then the speed up does not apply: it first tryes to connect to the local instance, waits until it fails and the connects to the remote instance.

dilyanpalauzov commented 3 weeks ago

DAVx5 has a setting WiFi SSID restriction described as:

Use WiFi SSID restriction to restrict synchronization to one or more specific WiFi networks (requires location permission, including background location). List all allowed SSIDs as a comma-separated list, for instance SSID1,ssid2. Hidden networks and SSIDs with commas are not supported.

Recently I was in a public Wlan and started OpenHAB-Android. It asked me to confirm a certificate. As it turned out in this network on the ip and port I habe configured for local connection in OoenHAB-Android another web server was listening in the public wlan. So the only way to use OpenHAB-Android there was to disable the local connection.

It would be good if OpenHAB-Android has similar functionality to skip local connections, if the wlan name is not within a list.