ESP32 static IP

I have a esp32 that is giving me fits. I have been trying to assign it static IP. But HA still tries to use the original IP.
For Instance. the original IP from my DHCP server was 192.168.1.109 I wanted it to be static at 192.168.1.165. I went into the ESP32 YAML and added

use-address:  192.168.1.109
Manual_ip
static_ip: 192.168.1.165
gateway: 192.168.1.1
subnet: 2255.255.255.0

Saved it and then installed it wirelessly. all went fine. I went back into the Yaml and removed the use_address, saved and installed. again all went as it should.
I went into the terminal and tried to ping the device using the name controller1.local. HA came back with 192.168.1.109 and couldn’t ping the esp. I was able to ping 192.168.1.165 but not 192.168.1.109, which is what I expected. So how do I get HA to update controller1.local to 192.168.1.165? The ESP somehow works intermittantly. Does HA use the url or the IP address to contact the device?
Thanks

Remove the device in ha and add it again with the new ip

1 Like

When you set the new IP for that device, did you also configure a device name for it on the router? It may simply be that the internal mDNS has not updated yet.

Looks like your device is getting the new IP, somprobabkynremoving/adding as suggested by @WallyR will fix the issue, however, if you still having some issue, I’d like to suggest to share your settings with better formatting, as I cannot see the right spaces for each row, I can see upper case, etc…

Something like this is much easier to read:

# Example configuration entry
wifi:
  ssid: MyHomeNetwork
  password: VerySafePassword

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.0.123
    gateway: 192.168.0.1
    subnet: 255.255.255.0

I’ll give that a try

Sorry about the formatting. I used the correct format with another ESP32 and it worked fine, of course changing the IP.
When adding it back into HA do I use the IP address or the url controller1.local ? Never have been clear on that.

another hint.
Limit your DHCP server range so that it doesn’t cover the IP range where you defined static ones.

If going further, I’d recommend using the lower IP range for the static ones. For the simple reason, if you’re in need to run a portscan, arp, … to see if all devices are up and running you could for example do so by scanning a range from 1-100, while from 101-254 is the DHCP range, which you’ll find the mobiles from your friends if visiting you. Something you’re surely not that much intererst into.

And you could even cluster your static devices, sort of 1-10 network devices, 11-20 computers, 21-50 smartphone gadgets and so on. Similar to real life … the more you structure the things the easier it gets if in need to locate something.

1 Like

Thanks justone

I have my IPs clustered and it does make it easier. I removed the single instance from the HA integration, added it back in and so far so good. It appears to have repaired the mdns in HA.

Thanks everyone for your help and suggestions!

1 Like