Remote access on ESPHome devices (different WiFi network)

Hello, I have some ESPHome devices working on HA, and they work just great, but now I would like to add a relay + ESP-01 to control a doorbell, just like Frenk did in this post:

The problem is… At the door, there’s a different WiFi network!

I have complete access and I can modify anything on that network too, but since its not the same LAN where HA is connected, it can’t be discovered.

Do you know any workaround to control an ESPHome device remotely / in a different network?

There is some advice near the bottom of the FAQ: Frequently Asked Questions — ESPHome

Note

ESPHome uses mDNS to show online/offline state in the dashboard view. So for that feature to work you need to enable host networking mode

mDNS might not work if your Home Assistant server and your ESPHome nodes are on different subnets. If your router supports Avahi, you are able to get mDNS working over different subnets.

Just follow the next steps:

  1. Enable Avahi on both subnets.
  2. Enable UDP traffic from ESPHome node’s subnet to 224.0.0.251/32 on port 5353.

Alternatively, you can make esphome use ICMP pings to check the status of the device with the Hass.io Addon "status_use_ping": true, option or with docker -e ESPHOME_DASHBOARD_USE_PING=true See also Dashboard status light not working across subnets/zones · Issue #641 · esphome/issues · GitHub.

I don’t have Avahi in any of the routers, and they are not actually subnets, they are two routers with completely different internet providers, different IPs…

Is there anyway to, for example, create a duckdns adress for the second router, forward the ESP-01 port and make HA discover the device, from myhomeassistant.duckdns.org to esp01wifi.duckdns.org?

With sonoff I have not a problem if its in another LAN, maybe because with HACS it connects both from the cloud or LAN.

Any other ideas to connect an ESPHome device in another LAN?

Maybe a VPN tunnel would work, but I’m not sure.

Did you ever figure this out? I’m trying to do the same thing. Have HA setup at one location and have outlets at another location that doesn’t have HA.

Instead of using the ESPHome API and attempting to setup a VPN tunnel, look into using an external cloud MQTT broker. The remote nodes publish their data to MQTT and HA subscribes to those topics to retrieve the data.