Change IP address in yaml file?

I need to change the IP address in the said file for my ESP. Presently the yaml file has:

# Optional manual IP
    manual_ip 
         static_ip: 192.xxx.x.x  
         gateway: 192.xxx.x.x
         subnet: 255.255.255.0

The static ip is unreachable due to a change of router, so I would like to change it to a DHCP assigned . What is the best way to do that, I have changed the name of the ssid on my phone, but not sure about how to edit the ip address.
Thanks

3 possible ways depending upon what really changed.
If the ssid, pwd and the last 3 parts of your IPs range did change

  1. dead easy
    use an usb cable and flash using the serial port

  2. depends
    if you have the lines

web_server:
  port: 80

in your existing YAML code you could likely connect to the device since it started in AP mode if it wasn’t able to connect to it’s known network. For example if the ssid chanced.
You can then
a) compile or run/upload the YAML with the new settings
b) connect with a machine to that AP network
c) use the OTA button from the web_server and upload the compiled file to the device
d) but it not only depends upon the web_server being enabled you must also have access to the compiled from that browser window.

If you once changed the last x after the last dot, condigure the ssid and pwd of the new router so it matches the old router and add the line
use_address: for 1 OTA flash. Device will then boot with the IP you defined in static_ip:
and don’t forget to remove the use_address: line for future OTA flash operations.

Can’t think of anything else

1 Like

Thanks, but I don’t really want to change anything on the new router because everything else I have to do with wifi has been configured to use the new settings

Pardon me for not understanding properly, but how do I actually edit the the IP section, because it is not seen in my routers wifi list.
I don’t have any web server line in the yaml file
I did change the last x to another number but still no joy.

By AP, I take it you mean access point, and they are using the new settings.
If the IP section can’t be edited, I suppose I would have to start afresh?
Thanks

Did you set up a fallback hotspot?
If so, it should setup a hotspot, you can connect to it, and upload a new bin file OTA :stuck_out_tongue:

# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "FallBackHotSpot"
    password: "fallback"

I did , , but the password a mix of uppercase, lowercase and numbers

You should have the password in the yaml configuration so why is that an issue?

You only have to do it once :thinking:

With the esp device running, can you reach it currently? via ping?

1- compile a new configuration, choose manual download and save the bin somewhere on your device (can even be your mobile)
2- connect to the hotspot with that device
3- open the web page of the esp with a browser
4- install the bin file you compiled in step 1
image

Further, I do recommend to use dhcp.
In your router you can make a dhcp reservations so it will always get the same addres
That :wink:

Two ways to preserve the work you might already have done.

  1. Backup the router config. That options should be there somewhere. Then set it up the old way and correct the ESPHome.
  2. Try to use a mobile phone as wifi hotspot with the old SSID and password. The ESPHome device should then connect to that when it it rebooted.

Thanks but I have decided to start afresh.