Hi,
I’m starting to use Home Assistant, with a view on mainly setting up a home-made alarm system. Though the activation could be manual, I’m already thinking of using phones to switch it on/off automatically. I have one big constraint though: I can’t rely on Location info being enabled on our Android phones (my wife will not agree to that, for battery and privacy reasons; it is what it is).
I’ve considered the following approaches:
- use Wifi-based rules using the phones’ Wifi-based sensors to detect when we’re home => requires Location, out of the equation
- use our Wifi router and PLCs to detect the phones’ presence => our router has no integration, and the PLC has one but it seems to only count the connections, not identify the devices; discarded
- compare the public IP of the server (using the My_IP sensor) and of the phones (using the public IP sensor from the apps) => sounds great! It doesn’t require location to be on. But …
After setting that up, I realized I needed the phones to be able to communicate the public IP when out of the home network. So I set up a reverse proxy. The app is configured for my public, HTTPS address as external URL, and the local, HTTP one for internal. For added security, I set up Authelia password protection on the URLs that don’t start with /api/ (can’t do much about the /api/ ones, of course!). But that doesn’t work. As soon as I switch off location on my phone, the internal URL support becomes grayed out, and the app only attempts to connect via the public URL – which means, it has to go through Authelia, and for some reason, that doesn’t work. From that point on I can’t go back to the app at all, it keeps opening a browser and showing an error message after I log into Authelia.
Now … Why is internal URL not supported when location is off? especially when the option to “always use the internal URL first” is explained as “good if you typically leave location off” !!! I would really like to have this simple logic: location is off, but the app tries to communicate using the local address first, and if that times out, it reverts to the public one. What’s wrong with that, except for some extra delay, I suppose, as it would need to wait for the timeout every time? This has driven me half-crazy.
For now I’ve just removed Authelia entirely, so I’ll rely on Home Assistant’s own security only for the landing page, still behind HTTPS of course. But I’m not 100% happy with that state of things. In fact, I’d really like an easy way to know when my phone is home without location services and without opening Home Assistant to the outside, if there were such a way.
Cheers,
Pierric.