mDNS and VLAN woes

Trying to set up an ESP32.
My ESP never appears online in ESPHome Device Compiler. I created a .bin and uploaded it manually. ESP boots and connects to wifi (I can access its web ui, I can add it to HA using ip which i have fixed from DHCP server).

How do I make it appear online in ESPHome Device Compiler?

“Downloading logs” seems to result in:

INFO ESPHome 2024.11.3
INFO Reading configuration /config/esphome/kaminaringi-termostaat.yaml...
INFO Starting log output from kaminaringi-termostaat.local using esphome API
WARNING Can't connect to ESPHome API for kaminaringi-termostaat.local: Error resolving IP address: [Errno -5] No address associated with hostname (APIConnectionError)

It also does not seem to resolve from Home Assistant command line:

[core-ssh ~]$ ping kaminaringi-termostaat.local
ping: bad address 'kaminaringi-termostaat.local'

Yes, it is in a different VLAN. However, I am using an mDNS repeater. kaminaringi-termostaat.local resolves perfectly well in my laptop which is at the moment in the same VLAN as HA. It also shows up few seconds after booting in an mDNS app called “Discovery”.

Screenshot 2024-12-11 at 21.24.43

Does .local resolve in your network?

.local is special-use domain for mDNS, I am not sure what you mean by “does it resolve in your network”.

As I said, I can resolve it in my laptop but not in HA

In the wifi section config, set the devices static IP or you can configure use_address.

Setup multicast forwarding so your multicast traffic is broadcasted to the vlans you want.

Can you be more specific? What/from/to which ports does the ESPhome send multicast? UDP?

Sure, I’ll be very specific. Read up on how multicast works, read up on what vlans are.

You’re sending a multicast packet to a certain lan/VLAN. It won’t transverse lans / vlans without explicit permission to do so (aka a multicast forwarding setup). So, if your esp device and your laptop are on the same lan/VLAN, you’ll be able to see it. If the esp device is on your lan and your Hass machine is on VLAN 20 and Hass sends a multicast packet, only VLAN 20’s multicast address is sent the packet. The lan multicast address will never see it unless your switch or firewall routes the packets to that destination network.

If you want other people to do all the work for you, maybe get a better attitude.

I am quite aware how multicast works and what VLANs are.
I am not sure where you get the attitude part. I am not expecting you to do all the work for me.

As I said in my first post:

  • I have mDNS repeater running which takes care of broadcasting mDNS packets between said VLANs
  • a computer in the same VLAN as HA can resolve the mDNS name of the ESP in question successfully
  • for some reason HA can not

I can also add that mDNS between my IOT VLAN and the HA VLAN generally works - new Shellies, etc. are automatically discovered. So this is something ESPHome specific. For example for TUYA devices, I also needed to proxy UDP broadcasts on ports 6666 and 6667 (not related to mDNS per se) between VLANs to make them work with localtuya integration.

So if you are saying “setup multicast forwarding”, I am asking which traffic specifically?

Possibly related. One commenter thinks switching framework to Arduino fixes the problem and problem occurs in ESP-IDF framework binary. ESP32 devices show offline, mDNS not working correctly · Issue #6311 · esphome/issues · GitHub

That is interesting, thanks. Will take a look.
Although someone in that thread writes that mDNS does not work from computer as well. For me it still works from a computer (MacOS), but not with ESPHome Device Compiler (which is inside a docker).

udp 5353 should be the protocol and port.

Yeah, UDP 5353 is mDNS and that is forwarded between VLANs via mDNS repeater and as I said, mDNS resolving works from MacOS.

As far as I can see with tcpdump on the router, UDP packets originating in IOT VLAN interface to 224.0.0.251:5353 are forwarded to HA server VLAN and vice versa.