Accessing ESPhome instance via the internet

Hello team,

My HA instance is in my house and I use a public MQTT broker. A tasmotized MQTT device, located in the other end of town (but has access to through a WIFI router to the internet) sends signals back and forth to HA.

Would this be possible with ESPhome? And if so, how?

Thank you, Yann

As long as both ends of the communications connect to the same MQTT broker, then it doesn’t matter if they are in the same room or the same country.

exactly, and that is why I am using tasmota which is MQTT based.
But would it be possible to use ESPhome which uses AFAIK a propriety protocol with HA instead?

ESPHome can use MQTT. But for the proprietary protocol, I guess only with the proper forwarding on your router.

I don’t understand this. MQTT simply delivers a payload. It’s up to your device what to do with the information.

OK, never realized ESPhome is capable of doing MQTT.
It makes me realize there is a lot I do not know of ESPhome. Are there any good examples of using ESPhome with MQTT ?

I believe the OP wants to let ESPHome connect directly to HA using HA’s native API, instead of the additional overhead of managing an MQTT instance.

The native API works fine on a LAN, but across the Internet would require that HA be fully exposed to at least the address of the ESPHome device. That’s pretty risky. Likewise, exposing MQTT might be similarly risky.
Consider instead a site-site VPN tunnel, configured as a link between their respective LANs. Then the native protocol would work as if it were just crossing a router (i.e. different subnets, so might require manually telling HA the address of the ESPhome device), and nobody needs to be exposed directly to the Internet.

Yes, this.

And only when there is this VPN tunnel in place , it will be possible to update/reconfigure the ESPhome device through the HA ESPhome add-on. Makes sense.