Flash new code and ESP runs but restarted the device is not on

After a couple of yaml tweaks, I used OTA and reflashed 3 garage door controllers that have been in use for about a year. I mistakenly flashed this device with the hardcoded IP address of a twin. After that mistake I tried to re-flash the same device with the correct IP. I got a message the OTA connect failed. So I took the laptop to the Garage and connected USB and I can flash the device and with ESPhome it connects to now add all looks good. Pic 1 except when I disconnect the device from the laptop and re-connect to the power supply it stops. Pic 2
Just for grins I tried NodeMCU flasher and did the reset and then the flash with the same results except I needed to press the reset after flashing.

I tried adding “dns1: 192.168.1.1” in a subsequent flash but it didn’t help

Thanks

esphome:
  name: garagedoor_middle
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "GoonNet"
  password: "........"
  manual_ip:
    static_ip: 192.168.1.23
    gateway: 192.168.1.1  
    subnet: 255.255.255.0
    dns1: 192.168.1.1

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

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: ".........."
  services:
    - service: pushbutton_door
      then:
        - switch.turn_on: relay
        - delay: 500ms
        - switch.turn_off: relay

Later in the day –
I tried flashing the yaml for another working door and get same result.
I did also try changing the IP address and the log does show the new IP address

Using 'COM3' as serial port.
Connecting....
Detecting chip type... ESP826 %)Writing at 0x00044000... (100 %)Wrote 416304 bytes (285408 compressed) at 0x00000000 in 6.6 seconds (effective 507.6 kbit/s)...
Hash of data verified.

Leaving...
Hard Resetting...
Done! Flashing is complete!

Showing logs:
[17:46:35][I][logger:166]: Log initialized
[17:46:35][C][ota:366]: There have been 1 suspected unsuccessful boot attempts.
[17:46:35][I][app:029]: Running through setup()...
[17:46:35][C][switch.gpio:011]: Setting up GPIO Switch 'Garagedoor_east Toggle'...
[17:46:35][D][switch:025]: 'Garagedoor_east Toggle' Turning OFF.
[17:46:35][D][switch:045]: 'Garagedoor_east Toggle': Sending state ON
[17:46:35][D][switch:025]: 'Garagedoor_east Toggle' Turning OFF.
[17:46:35][D][binary_sensor:034]: 'close_sensor': Sending initial state ON
[17:46:35][D][binary_sensor:034]: 'open_sensor': Sending initial state ON
[17:46:35][C][wifi:033]: Setting up WiFi...
[17:46:35][D][wifi:324]: Starting scan...
[17:46:35][D][text_sensor:015]: 'Garagedoor_east State': Sending state 'Unknown'
[17:46:35][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 0.42800 s with 0 decimals of accuracy
[17:46:41][D][wifi:339]: Found networks:
[17:46:41][D][wifi:341]:   No network found!
[17:46:46][D][wifi:324]: Starting scan...
[17:46:49][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 13.79200 s with 0 decimals of accuracy
[17:46:52][D][wifi:339]: Found networks:
[17:46:52][D][wifi:341]:   No network found!
[17:46:57][D][wifi:324]: Starting scan...
[17:47:03][D][wifi:339]: Found networks:
[17:47:03][D][wifi:341]:   No network found!
[17:47:04][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 28.79200 s with 0 decimals of accuracy
[17:47:08][D][wifi:324]: Starting scan...
[17:47:14][D][wifi:339]: Found networks:
[17:47:14][D][wifi:341]:   No network found!
[17:47:19][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 43.79200 s with 0 decimals of accuracy
[17:47:19][D][wifi:324]: Starting scan...
[17:47:24][D][text_sensor:015]: 'Garagedoor_east State': Sending state 'Unknown'
[17:47:25][D][wifi:339]: Found networks:
[17:47:25][D][wifi:341]:   No network found!
[17:47:30][D][wifi:324]: Starting scan...
[17:47:34][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 58.79200 s with 0 decimals of accuracy
[17:47:35][I][wifi:116]: Starting fallback AP!
[17:47:35][C][wifi:161]: Setting up AP...
[17:47:35][C][wifi:163]:   AP SSID: 'Garagedoor_East'
[17:47:35][C][wifi:164]:   AP Password: 'edit'
[17:47:35][C][wifi:167]:   AP Static IP: '192.168.1.50'
[17:47:35][C][wifi:168]:   AP Gateway: '192.168.1.1'
[17:47:35][C][wifi:169]:   AP Subnet: '255.255.255.0'
[17:47:36][C][wifi:173]:   IP Address: 192.168.1.50
[17:47:36][D][wifi:339]: Found networks:
[17:47:36][D][wifi:341]:   No network found!
[17:47:41][D][wifi:324]: Starting scan...
[17:47:47][D][wifi:339]: Found networks:
[17:47:47][D][wifi:389]: - '' (E2:63:DA:37:70:39) ▂▄▆█
[17:47:47][W][wifi:394]: No matching network found!
[17:47:49][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 73.79200 s with 0 decimals of accuracy
[17:47:52][D][wifi:324]: Starting scan...
[17:47:58][D][wifi:339]: Found networks:
[17:47:58][D][wifi:341]:   No network found!
[17:48:03][D][wifi:324]: Starting scan...
[17:48:04][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 88.79200 s with 0 decimals of accuracy
[17:48:09][D][wifi:339]: Found networks:
[17:48:09][D][wifi:341]:   No network found!
[17:48:14][D][wifi:324]: Starting scan...
[17:48:19][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 103.79200 s with 0 decimals of accuracy
[17:48:20][D][wifi:339]: Found networks:
[17:48:20][D][wifi:341]:   No network found!
[17:48:24][D][text_sensor:015]: 'Garagedoor_east State': Sending state 'Unknown'
[17:48:25][D][wifi:324]: Starting scan...
[17:48:31][D][wifi:339]: Found networks:
[17:48:31][D][wifi:341]:   No network found!
[17:48:34][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 118.79200 s with 0 decimals of accuracy
[17:48:36][D][wifi:324]: Starting scan...
[17:48:42][D][wifi:339]: Found networks:
[17:48:42][D][wifi:341]:   No network found!
[17:48:47][D][wifi:324]: Starting scan...
[17:48:49][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 133.79201 s with 0 decimals of accuracy
[17:48:53][D][wifi:339]: Found networks:
[17:48:53][D][wifi:341]:   No network found!
[17:48:58][D][wifi:324]: Starting scan...
[17:49:04][D][sensor:092]: 'Garagedoor_east Uptime': Sending state 148.79201 s with 0 decimals of accuracy
[17:49:04][D][wifi:339]: Found networks:
[17:49:04][D][wifi:341]:   No network found!
[17:49:08]

Solution:
Let DHCP assign IP addresses. x.x.x.23 was apparently leased to some device recently and not available. .24 was not used when I checked but was leased to a phone. When I removed the hard coded IP the router assign .89 and all was well.

Use static ip addresses outside your DHCP server address range to prevent this sort of thing happening.