Access from internal and external network

Hello,
At the moment my ISP provides me with an internal (private) IP address only. This, as I understand, prevents an easy access to my HA server when I’m away.
Of course, HA Android app works very well when I’m at home.
Soon, however, I will be provided with an external (public) IP address.
What step do I need to take to ensure that HA Android app uses my internal address when I’m at home and external address when I’m away? Or will only the external address be always used? First, of course, port forwarding will have to be set on my Ubiquiti UDR router.

This is a setting in the Android app. Configure your home WiFi name and it’ll know to use the internal URL when connected to that WiFi, and the external URL otherwise.

Tinkerer’s answer should work, but if you’re planning on using port forwarding, it’s highly recommended to secure your connection using https as per home assistant

Thanks.
Actually, I am struggling with setting up Wireguard VPN.
I have fiber teminal with public IP on WAN side and 192.168.33.1 address on LAN side. Then there is my Ubiquiti UDR router but I have failed either at port-forwarding on my ONT terminal or Wireguard configuration on my UDR router - no proper handshake.
I’ll keep trying though.

2023-08-02 16:19:42.035389: [MGR] Starting WireGuard/0.5.3 (Windows 10.0.19044; amd64)
2023-08-02 16:19:42.037940: [MGR] Starting UI process for user ‘boGGio@DESKTOP-MJTUEDO’ for session 1
2023-08-02 16:20:14.437824: [TUN] [wg_c0_a8_08_03] Starting WireGuard/0.5.3 (Windows 10.0.19044; amd64)
2023-08-02 16:20:14.437824: [TUN] [wg_c0_a8_08_03] Watching network interfaces
2023-08-02 16:20:14.438844: [TUN] [wg_c0_a8_08_03] Resolving DNS names
2023-08-02 16:20:14.438844: [TUN] [wg_c0_a8_08_03] Creating network adapter
2023-08-02 16:20:14.467177: [TUN] [wg_c0_a8_08_03] Using existing driver 0.10
2023-08-02 16:20:14.476992: [TUN] [wg_c0_a8_08_03] Creating adapter
2023-08-02 16:20:14.564000: [TUN] [wg_c0_a8_08_03] Using WireGuardNT/0.10
2023-08-02 16:20:14.564000: [TUN] [wg_c0_a8_08_03] Enabling firewall rules
2023-08-02 16:20:14.550143: [TUN] [wg_c0_a8_08_03] Interface created
2023-08-02 16:20:14.565536: [TUN] [wg_c0_a8_08_03] Dropping privileges
2023-08-02 16:20:14.566044: [TUN] [wg_c0_a8_08_03] Setting interface configuration
2023-08-02 16:20:14.566044: [TUN] [wg_c0_a8_08_03] Peer 1 created
2023-08-02 16:20:14.567060: [TUN] [wg_c0_a8_08_03] Monitoring MTU of default v6 routes
2023-08-02 16:20:14.567060: [TUN] [wg_c0_a8_08_03] Interface up
2023-08-02 16:20:14.567569: [TUN] [wg_c0_a8_08_03] Setting device v6 addresses
2023-08-02 16:20:14.570114: [TUN] [wg_c0_a8_08_03] Monitoring MTU of default v4 routes
2023-08-02 16:20:14.570114: [TUN] [wg_c0_a8_08_03] Setting device v4 addresses
2023-08-02 16:20:14.572667: [TUN] [wg_c0_a8_08_03] Startup complete
2023-08-02 16:20:14.580909: [TUN] [wg_c0_a8_08_03] Sending handshake initiation to peer 1 (192.168.33.2:51820)
2023-08-02 16:20:19.600276: [TUN] [wg_c0_a8_08_03] Sending handshake initiation to peer 1 (192.168.33.2:51820)
2023-08-02 16:20:24.729655: [TUN] [wg_c0_a8_08_03] Handshake for peer 1 (192.168.33.2:51820) did not complete after 5 seconds, retrying (try 2)
2023-08-02 16:20:24.729655: [TUN] [wg_c0_a8_08_03] Sending handshake initiation to peer 1 (192.168.33.2:51820)
2023-08-02 16:20:29.788165: [TUN] [wg_c0_a8_08_03] Handshake for peer 1 (192.168.33.2:51820) did not complete after 5 seconds, retrying (try 2)
2023-08-02 16:20:29.788165: [TUN] [wg_c0_a8_08_03] Sending handshake initiation to peer 1 (192.168.33.2:51820)
2023-08-02 16:20:34.825915: [TUN] [wg_c0_a8_08_03] Handshake for peer 1 (192.168.33.2:51820) did not complete after 5 seconds, retrying (try 2)
2023-08-02 16:20:34.825915: [TUN] [wg_c0_a8_08_03] Sending handshake initiation to peer 1 (192.168.33.2:51820)