Remote access on ESPHome devices (different WiFi network)

Tags: #<Tag:0x00007f739aa9ea60> #<Tag:0x00007f739aa9e768> #<Tag:0x00007f739aa9e5d8> #<Tag:0x00007f739aa9e3f8>

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: https://esphome.io/guides/faq.html

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 https://github.com/esphome/issues/issues/641#issuecomment-534156628.

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.