I creatively re-purposed my old C8 hub in my truck-topper to manage sensors and alert me if large furry creatures were coming ‘round to cuddle in bed for dinner.
Given the use case, I’m often well out of cell/wifi range–so I fire up my Android phone’s hotspot and let the hub connect to it. The issue is that it uses a WIDE range of IP addresses and they change all the time (pretty much 10.x.x.x of any sort) and, currently, I haven’t figured out a way to find the IP address of “hotspot connected” devices from my phone.
And, the Hubitat App seems to demand a working internet connection to actually find my hub.
Is there any way to make the app work without an internet connection so it can work in remote locations better?
You could add a wifi travel router to the equation. Reserve the IP for your hub in the travel router so that it never changes. most of them can also be tethered to a cell phone or other hotspot for internet, when you are in range. (Note: If you are tethering from your phone for internet, you might not be able to access the other clients on the network. Not sure how that works as I always use a separate hotspot for mine)
But, that's more equipment and expense that seems to be totally unnecessary, aside from being an expensive workaround. Given the limited space in my truck and limited power options, that's not really feasible.
I'd think "find" function would be something the app could have built in?
I know I'm not the only user with a largely remote hub. Thus, putting the code in the app itself would be useful.
The Hubitat is not an AP,nor a router, nor a DHCP server. Its a client on the IP network. it can’t assign itself an address on a network it doesnt control. When you are tethered to your phone you’re relying on the ip services (dhcp) etc from the provider to assign you an address (or NAT you on/over phones IP depending on the connection).
You can get a small cheap wifi travel router for 20-30 bucks.
"Find" isn't going to work, without the internet. That all said, in this use case, seems like you could assign a static IP address to the hub in the range of 192.168.43.x (mask of 255.255.255.0), - And I believe the IP of the Android phone hotspot is typically assigned as 192.148.43.1 (see https://www.reddit.com/r/tasker/comments/c6t5vi/get_ip_address_of_hotspot_tether/ )
That said, it looks like Samsung uses a different range (192.168.6.x/), but I'm assuming the phones hotspot IP is at least fixed. - See https://www.reddit.com/r/androiddev/comments/ncd38c/new_network_address_on_android_11_hotspot/ . Its not critical to know the phone's IP (as your not routing anything out), you just want a static address in the same subnet on the hub, so the phone can connect to the know IP of the hub.
I also think there is some endpoint on the hub to enable traffic from the de-dacto 192.168.1.x subnet range, as it's some junior level security the you need to effectively disable, for other subnets to connect to it. I don't remember that endpoint off the top of my head, but thats also likely going to trip you up
I'm not sure why find wouldn't work without the Internet, as it just needs to locate the device on the local lan (doing the advanced find by MAC address).
My phone seems to use random 10.x.x.x addresses.
More annoying is that they don't provide a way to see what devices and IPs the phone's hotspot is using.
Yeah, that's common on basic Android. (not showing the connected devices IPs) -
What sort of phone is this, as we're not asking about what addresses it's handing out, via DHCP. What you want is the actual IP address of the phone's hotspot itself (gateway), and that should be fixed in Android (unless things have recently changed) - I'm curious as to the make/model, if it's bouncing around randomly.
The idea is to get rid of the "randomness" and just get everything set as fixed/static
It works fine with just a LAN (hence the travel router recommendations)- No internet required.
Edited to add - I highly suspect that the phone isolates itself from clients connected over hotspot (for security reasons) - and that you would be looking at having to root to get around that.
A travel router can do this easily and cheaply regardess of whether you have WAN (i.e. Internet)
I tested your requirements with an Android App called "Network Analyzer" by Jiri Techet. This app contains many network related tools, including a LAN Scanner.
If I perform a LAN scan when my Pixel 7 is connected to WI-FI, and devices are connected to to my Hotspot, the scanner will only show devices on the Wi-Fi network.
If I turn off Wi-Fi, then it will show devices connected to my Hotspot.
Recent versions of Android denies permissions for new apps to access MAC addresses of other devices on the network. Because of that I use version 3.12 of the app rather than the current version of 4.2 because the old version still let's me view MAC addresses.
This limitation in version 4.2 shouldn't affect your needs, but be aware that I only tested this with version 3.12. If you need the older version, the developer has it available on his website.
Not sure if your Pixel is rooted - But the following gets into some detail as to what's going on, in later versions of Android, in terms of the random IPs (it's no longer static @ 192.168.43.1) - As well as options to make things static - Assuming you have root access:
On a normal UNIX/Linux box (which Android is): ip neigh will get you that info - (see: ip-neighbour(8) - Linux manual page) - But I believe it will require root or at least ADB access.
Or you can use an app, like "Network Analyzer" or "Fing" - Or if you really want to get into the weeds: Ksiri Tools