Same SSID two different router - HA has problems

I have two homes with 150 km distance and same WLAN SSID. In the first one home is the HA server located. All works fine.

If I am in the second home with the same WLAN SSID, the HA APP on the mobile assumes it is in the first location and try to connect via the internal SSID to the HA server - not possible.

If I switch of the WLAN on the mobile off - it works and I can connect to my HA server on the first location.

Why you don’t look on the WLAN SSID and MAC Adress of the WLAN connected - then this problem will disappear?

As a workaround, set up the second network to forward the requests to the HA instance on the first network!

It would disappear for your setup, but all users having multiple APs for their WiFi network would then have issues.
Multiple APs have been used for many many years and have almost become the norm with the introduction of mesh networks.