Configure the esp8266 module to work with an external HA server

My HA server is not on the local network. I keep it on vds. What line should be added to test.yaml so that ESP can contact the server http: //94.250.ХХХ.ХХ

MQTT or API?

I use the API. I managed to forward ports. HA sees the device, but the esphome add-on cannot flash OTA is not convenient. I want to configure so that port forwarding is not needed. Since the device can change the provider of the Internet.

You do not need to run esphome on your home assistant computer. Run it locally.

OTA has to contact your ESP device on a port. That is just networking for you. If you want to run the computer running esphome from outside your network, you have to forward a port, or run a VPN or somehow else allow the connection.

1 Like

Thanks for the help.
Is it possible to force esphome firmware to communicate with an external HA server without port forwarding using the API?
My problem is that ESP does not have a static IP; it is portable and can change access points.

Use a vpn.

1 Like

if you use vpn, you will always have to take a configured access point with you. I thought there is an opportunity in the esphome firmware to specify the server with whom to connect.

What? VPNs do not require an access point.