ESPHome use IP instead of *.local

Is there a way to force ESPHome to use the IP assigned to a specific device instead of using something.local?

I have a few that start off fine, they show up, I can ping them by ping ble_proxy_02.local, but it only lasts a few seconds, then they go offline. Except - they don’t. I can still ping with using the IP. But ble_proxy_02.local stops working, which means the integration in Home Assistant stops as well.

I’m pretty sure this happens every time I power cycle the ESP32.

Or am I just doing something wrong? This happens even with any basic config I copy from e.g. the ESPHome website. It doesn’t happen for all devices though, but i haven’t been able to see any pattern in config that would explain this (they are all on the same VLAN with no internet access, but where HA has full access).

EDIT: It seems that if I open the logs from the ESPHome panel in HA UI (only if choosing “plug into this computer”), it shows up again.

1 Like

Your mdns is broken.

1 Like

Is your home assistant connected on the same vlan too or via router?
If the later then you want to allow port 5353 from your vlan to your router.
Not sure if this is the way, but I have the same setup with IoT network and in it I allow port 5353 to the router and have not had any issues as this will allow the multicast.
Think I did this when I had issues connecting to nodes.

use_address what you’re looking for?

1 Like

No, that’s for a changed ip address.

Maybe I’m not doing it right then.

  1. I have HA on one VLAN (VLAN30; 10.0.30.0/24), all iot (incl. ESPs) on another (VLAN20; 10.0.20.0/23)
  2. I have enabled mdns repeater on each interface (corresponding to the interfaces of VLAN20, and VLAN30). (I also enabled mdns reflector, although I don’t think this is necessary?)
  3. I have allowed port 5353 into the router from both VLAN20 and VLAN30 (well, only for the IP ranges that would need it, incl. all ESPs and chromecasts).

Anything I’m mising in this setup? I have multiple devices that use mdns on VLAN20 that work fine (e.g. a bunch of Chromecast devices, and at least 2 functional ESP8266/ESP32 devices that work fine with ESPHome).

@aceindy for #3, I set the wifi:domain in the ESP yaml config. With “add domain to router” you mean in your dns? Making a local DNS record for ble_proxy_02.local10.0.21.77 in the DNS (PiHole, not router for me).

1 Like

hard to tell, I checked my router, and what I can see is that I have mdns repeater on both LAN and IoT networks, and from IoT network I allow port 5353 also port 53 into the router.
Not sure what was the solution as this was setup a wild ago.

Can you ping devices in VLAN20 from a computer in VLAN30 and will you get better results if you connect that computer into VLAN20 and ping the same devices?

Strange thing is that you appear to have some devices in VLAN20 that has no issues.
The names have underscore… maybe that is an issue too?

I use this in my esp config. I have 2 vlans, access routed with firewall policy allow. I add an esphome device (each device is a separate integration) with it’s ip adress. Never even used names or mdns, works perfect. I have over 50 esphome devices this way.

@LCL I tried removing the underscores, but same result. And yes, I can ping the ESP device (by IP) from any VLAN. it’s only when trying the *.local it fails, and only after 5-15 seconds of the device being up. I think port 53 is just for local dns or dhcp requests (can’t remember which one), but they also have that.

@aceindy You even have the same router, that should make it easier!
Can I just apply the local domain broadly across the 10.0.20.0/23 range, or would that interfere with other things on that VLAN that uses mdns (in which case it would be changing dozens of dhcp reservations… :grimacing: )?

Dunnow, mDNS never worked properly for me, so i rely on DNS.
It also solved my ssl issue i would have if I wouldn’t assign the same domain locally, as I have external.
(so i don’t need to use nginx either ;))

Are you on Windows? I had to update a policy in order to access my Rpis using .local. It was not router related in my case. If this is your situation, I’ll try to locate the info to fix it.

@nickrout I think I’ll go with your initial answer being the closest after all.

After a firmware update of my EdgeRouter X, it seems stable

Finger crossed! But stable for several minutes now after upgrading to EdgeOS v2.0.9-hotfix.6. (I’ll update post if any changes to that).

@aceindy Maybe try the same, if applicable? It seems like you are also on EdgeOS. Let me know if you want to try, and want me to share full mdns-related config.

@DaveBKC Thanks, but I’m on macOS with HA itself is running in a VM on Ubuntu Server. But if it’s not a hassle, maybe others would appreciate it?

@sender I’m far from an expert, but I think that if you have firewall policy “allow” between the 2 VLAN (with no restrictions), then it’s just using mdns in the background without you having to know/interfere/set up. The problem is that I have restricted most access for my IoT VLAN to interact with anything else (incl. WAN). So I need to do a few tweaks to specifically allow mdns through for select devices.

1 Like

I was on 2.0.9 hf 5, didn’t notice hf 6 was released last Jan (thanks).
And well, don’t really care for mDNS, as my DNS works fine (can’t see why why i would bother either)

So you go by the old “if it’s not broken, don’t try to fix it!”. I wish I were that smart :roll_eyes:

My main advantage with having mdns working is that I don’t need to re-assign 40+ dhcp reservations to have an IP range within a /26 or /27 subnet mask with only ESP devices, so I can use your approach without the risk of assigning a “breaking” domain to all non-ESP devices. That’s my main advantage; my main reason is more pedantic, just that it really bugs me that something that should work doesn’t!

Hehe, not really, when I renewed my router (because my old one wasn’t fast enough for my new fibre-optic), i just ‘migrated’ my existing DNS structure. It wasn’t until a lot later I noticed mDNS wasn’t working 100%, as i don’t use it.

Why fix something I don’t use ??

(I already have time issues; so much to do, so little time)

Nope, mdns use multicast dns and thats not allowed in my rules. Hence I do not use the mdns names but the IP adresses.

Basically same issues:
have also edgerouter X, NO DHCP/DNS server configured.
Separate DNS/DHCP server for multiple vlans. HA is in vlan20, 192.168.20.x, xxxx.vlan20 domain
All ESP devices are in vlan10, 192.168.10.x, xxx.vlan10 domain
Can resolv the esp devices, short and fqdn from any device in the network. No fw rules between vlans active, all is allowed.
Can retrieve logs from esp devices, but apparently mDNS names are used to update status in ESPHome.
Have fqdn name in the esp device yaml, incl fixed ip address but still appears offline.

Have no idea where to add the vlan domain xxxx.vlan10 to be shure ESPhome can update status. Any help or direction is appreciated.

Ether fix mDNS across your vlans or use ping for the dashboard online status like described in the docs (FAQ).