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?
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?
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.
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.