Esphome dev builder - Use ping for status - not working (as expected)

Hope this is te correct place, first post… seems like a esphome thing to me…

I’ve been working on a esp32 that I will use in my caravan, while on holiday.
it monitor a BMS and some stuff in the caravan.

I connect it to the public wifi or my phones hotspot when on the move and use a wireguard config to have it “savely” connected to my home and home assistant.

all is working well, except the esphome devbuilder status, and ota+log ability
because i want the device to always use its tunnel IP i have disable mDNS.
With mDNS enabled for this device, as soon as i get home, the esphome instance changes its ip to a local subnet ip.
so i removed the esp from the esphome integration, added it under its wireguard tunnel IP, and disabled mDNS.

This works fine, all sensor updates are updating when switching over from hotspot/home wifi and vise versa.

The devbuilder instance i still reporting offline, so i set the check status on ping true. but the device is still offline in device builder, also i am not able to wireless see log, or do a ota.
I’ve set a dns record in my local dns server (Mikrotik router) this dns server is also set in my HA(os) instance settings>system>network

I noticed when doing a nslookup in a HA terminal is doesn’t use the DNS server, but a local 127.0.0.1 dns record thingy…
When i add the dns server ip in the nslookup it resolves fine.
I can ping the esp fine from the HA terminal.

I think have 2 questions:
1: In the esp devbuilder, does setting the ping status option still expect an locally known dns record to be resolved? is yes…
2 where can i add a local static dns record in my HAOS or esphome instance? since this apparently is needed to solve this?

I’m probably not understanding something but why not just assign it a static ip address?

a static ip doesn’t matter in this case (the device has a static wireguard ip (10.0.0.2))

i can give it a static wifi ip, but it has to be a local subnet ip (192.168.1.0/24) or wifi wont work…
it will from then on, always be looking for the esp on that ip. (the same thing with e dhcp ip, but ok)
thats why i changed the ip in the esphome intergration to the tunnel ip 10.0.0.2 to make sure, that when the esp is connected to a remote wifi connection, the esphome integration can stil find the esp.
with mdns as soon as i get home, de esp will then connect to the home wifi, esphome will see the local ip (shorter route) en automaticcaly change it to that ip.
when i then get to a remote location and use a external wifi connection, esphome will not find the esp anymore. because it will be looking for the 192.168.1.* ip.

disabling mdns solved this for the esphome intergration, because it will still be looking at the tunnel ip 10.0.0.2 that i manually set as its ip in the esp integration

but not for the esphome devbuilder addon, some how its not looking for the same ip? or maybe still looking for the old local ip? i have no idea where i can check this.

maybe this helps, this i how i set the static ip of the esp to my wireguard tunnel

wireguard:
  address: 10.0.0.2
  netmask: 24
  private_key: !secret wg_duijfleffs_privkey
  peer_public_key: !secret wg_duijfleffs_publkey
  peer_endpoint: !secret wg_endpoint
  peer_port: !secret wg_endpoint_port
  peer_allowed_ips:
    - 0.0.0.0/0

If it does not have a static IP because the IP is changing from your local address range to the wireguard range then it needs to use mdns for HA and ESPHome to discover it.

its only changing for the wifi connection, the esp has a static tunnel ip, edited the previous post to show it

this is where i set the static tunnel ip to the esp, this is also what changes to a local ip if i leave mdns on.
sensors from this intergation part work fine!

its the device builder that somehow doesn’t update the ip, or keeps a local dns entry with the old ip alive, not sure, i also dont see any real debugging options

this solved it :slight_smile:
use_address to override the local IP, i set it to use the tunnel IP.

wifi:
  use_address: 10.0.0.2
  networks:   
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
    - ssid: !secret werk_hotspot_ssid
      password: !secret werk_hotspot_password

i think i also have something else wrong, cause i see the logbook updating, but not the sensors it self this happend somewhere along the way…

But this solution with use_address did solve the issue, i will mark is solved!