ESPHome doesn't work on LAN without my full LAN domain

I use a DHCP server on my LAN and assign systems names because I can remember names, but can’t remember a bunch of IP addresses. I also use a full domain name for my LAN. For example, say I use the Oz theme I used to use, a system might be dorothy, scarecrow, wizard, or more. The full domain was emeraldcity.oz. I hardly ever have run into anything where I had to use the full local domain. For instance, I can open the web page on my media server with http://polychrome in Chrome or Firefox. I can just use ssh wizard to get to my main workstation. I’ve never had to type http://polychrome.emeraldcity.oz or ssh wizard.emeraldcity.oz.

In Chrome, I can easily pull up the ESPHome webpage on the device I’m working on now with http://scraps without an issue. I can even use http://scraps.local, which the ESPHome add-on in HA uses when I click on the box to go to an ESPHome device.

The problem is ESPHome devices don’t work this way. I was trying to use an httprequest on a new test system to reach ESPHome device I referenced on my LAN. When I specify the URL as http://scraps, it does not work. When I use https://esphome.io, I also don’t get a connection. When I used http://172.16.3.99, the IP address for scraps, I get a connection from one ESPHome system to scraps. When I use http://scraps.emeraldcity.oz, it works.

What is different with ESPHome that it needs the FQDN for my LAN and other functions don’t? And can I fix this? And why do I also have problems trying to reach the ESPHome site as well? (I also have this issue with Home Assistant, but I don’t know if it’s the same issue with both systems.)

What is the wifi settings in your yaml?

Wifi:


wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

I had not even looked at the wifi settings in the past. They were set up during initial install, I just typed in the SSID and password. Since I can’t find anything in the YAML file that ap refers to, are there assumed values or something like that?

Try setting domain.

You have read the docs haven’t you?

Reading them now. Since it was all automated, I wasn’t even thinking it was wifi - I kept thinking DNS.

I realize I had completely forgotten that when I configure a new system, I add “emeraldcity.oz” as the default search domain for any computer. It’s something I think about while setting up a system, but I forget about it later (which is why I set it up - so I can forget about it and focus on what other things I’m doing).

I see this in the docs:

  • domain (Optional, string): Set the domain of the node hostname used for uploading. For example, if it’s set to .local, all uploads will be sent to <HOSTNAME>.local. Defaults to .local.

The wording is confusing here. By using the name “uploading,” this paragraph means when the ESPHome device is uploading data, it uses the domain. Would it be more accurate to say this is the default search domain, so if I use a system name without the FQDN, that it will append this to the system name for any usage? That’s how I’ve seen it done in the past. And it’s not fully clear this applies only to hosts in the LAN. I want to verify that it won’t be added on to a FQDN, like https://esphome.io, but would be added to, say, scraps (from my earlier example), so if I add:

domain: "emeraldcity.oz

to my wifi component, it will change scraps to scraps.emeraldcity.oz for any system name I use without a domain, but won’t add it to an external url with a FQDN, such as esphome.io?

Still not clear, since it talks about uploading and not other types of network communication, just what domain does, but I tested it on my system by adding it and found it didn’t help and I still had to access the other computer by using the FQDN in the URL.

Is the esp’s dns pointing to your internal dns server?

I use a DHCP server, so if it’s picked up it’s IP address, it is getting that info from the DHCP server, but maybe specifying it explicitly would help. I’ll try that this evening.

Why don’t you look in the esphome logs, that should tell you what DNS server it has been given.

The only way I can specify what DNS to use is to specify a static IP for the device. It’s under manual_ip and that requires a static IP, gateway, and subnet, all of which would come from a DHCP server. Considering it seems to get that info, either from DHCP or my wifi router (pretty sure it’s not from the wifi router, but it could be), I would think it’s broadcasting for the DHCP server, then getting its own IP from it.

Here are the logs after a boot. Note there is no info on DNS or gateway listed in the logs at all, nor the DHCP server. All that would be 172.16.7.1. I’m wondering if the issue could be a default subnet, since this is at 172.16.4.99, and I use from 127.16.4.xxx to 172.16.7.xxx. If it defaults to a subnet mask of a 256 addrange, then it could be an issue.

I see in logs all ‘as is’ specified in YAML - subnet as well received from DHCP - gateway, DNS.

[10:45:22][I][app:100]: ESPHome version 2024.10.1 compiled on Oct 23 2024, 20:18:24
[10:45:23][I][app:102]: Project SONOFF.S26R2 version 
[10:45:23][C][wifi:600]: WiFi:
[10:45:23][C][wifi:428]:   Local MAC: C8:2B:96:07:4C:41
[10:45:23][C][wifi:433]:   SSID: [redacted]
[10:45:23][C][wifi:436]:   IP Address: 192.168.1.177
[10:45:23][C][wifi:439]:   BSSID: [redacted]
[10:45:23][C][wifi:441]:   Hostname: 'garland-entrance'
[10:45:23][C][wifi:443]:   Signal strength: -81 dB ▂▄▆█
[10:45:23][C][wifi:447]:   Channel: 2
[10:45:23][C][wifi:448]:   Subnet: 255.255.255.0
[10:45:23][C][wifi:449]:   Gateway: 192.168.1.1
[10:45:23][C][wifi:450]:   DNS1: 192.168.1.1
[10:45:23][C][wifi:451]:   DNS2: 0.0.0.0

Are you specifying to use a static IP? As far as I know you can only designate DNS1 by using Manual_IP, which requires a static IP address, subnet, and gateway to be specified. There are multiple reasons I want the DHCP server to handle that.

Odd. Now I’m getting DNS info in my logs. I seem to be having a larger problem of constant communication. I’m reading logs in the ESPHome addon in HA, but also from the website. Almost every time I do that, I see more information in one of those pages than in the other. I’ve seen that a lot, along with issues when I try to install a new config and I sometimes see that it didn’t get responses from the chip.

Anyway, here’s the DNS info, and I’m still having trouble. Here’s what I’m trying:

  • Local system, on LAN, using FQDN: Works
  • Local system, on LAN, using hostname only: Error
  • Internet website (esphome.io): Error
  • Internet website (same as above), but using IP address, not FQDN: Error

So this chip is having significant issues communicating with other computers.

Here’s the logs that show DNA and some other info: