ESP8266 not flashing correctly after update latest esphome

Hi, before raising an issue, I want to check here first.
I have several esp8266 and esp32 working. I needed to change the config of one of the ESP8266(nodemcuv2) and thought why not update Esphome to the latest and Python to v12.8.1 first on clean install.
I build and flash using Windows 10 pc.
The building looks ok and the flashing is successfully finished as well, but then the logging is giving rubish. See below.
Also the ESP won’t connect to wifi network, starts it’s fallback AP. I can connect to the AP and open 192.168.4.1 and click the correct AP and provide WPA2 key. I even get the green box, that the esp accepted the wifi ssid and key, and will change to use these. But the fallback AP stays or comes back.

I tried different baud-rates for the logger, but no difference. Any suggestions?

============================================= [SUCCESS] Took 56.12 seconds =============================================
INFO Successfully compiled program.
Found multiple options for uploading, please choose one:
  [1] COM6 (Silicon Labs CP210x USB to UART Bridge (COM6))
  [2] Over The Air (watermeterplus.local)
(number): 1
esptool.py v4.7.0
Serial port COM6
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: a0:20:a6:1b:de:1b
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00000000 to 0x0007dfff...
Flash params set to 0x0340
Compressed 513408 bytes to 359547...
Wrote 513408 bytes (359547 compressed) at 0x00000000 in 8.4 seconds (effective 487.6 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from COM6 with baud rate 115200
[22:37:49]\x9c\xe4p☻♦l |g\xf9\xff\xfc\xfb\x97\xff\xf1♫\xf4;\x97\xf8;>\xfe\xff\xee\xfc\xf8\xe2:\xfc\xe7\xfe\xec\xf8\xe2\xfep♀♀N\xe2|☻♀\x8f♀B\x8c\xf2no\xce♥♦♀d`♥\x90‼2No♦l ♥☼☻nr\x8e\x9b\x92n♦♀B\x84\xb2`♥☼s\xb2\xdf\xee☻♦♀b\x8c\x92`☻\x9c♥♦♀\xe4\x8f►\x92♀♦l ☻\xfc\x82~\xe7?o\xff\x84\xe2♥\xe4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e0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0
[22:53:51] ets Jan  8 2013,rst cause:2, boot mode:/\xe6\xdd\xe9\xfd\xe1N\xffload 0x4010~>7\xe6↔\xeb\xbf𺞮\xffr\xba\xbf\xbf\xedp9>\xfe\xf3\xf8tail 0
[22:53:51]chksum 0x2e
[22:53:51]load 0x3fff20b8, len 40, room 8\xe0\xedz|}op8☼\xffsx⌂\xff\xf5}8<⌂\xe6\xfc^\xfe\xebu\xfd\xe8\xf2\xfdr\xfd\xf1\xf9\xf0\xf3\xf1\xfb\xe2j
[22:53:51]~ld

It looks like you changed too many things all at the same time to know what really happened.

When I run into an issue like this, I always go back to what I do know. I would start with a minimal program and preferably a new/different esp device to see if that works.

I guess you were right. I went to whole cycle of flashing with other tools, arduino IDE with basic blink. All worked.
Went to esphome/projects Empty ‘ESPHome device’(Ready-Made Projects — ESPHome), but the esp web tools(inc web.esphome.io just hang on ‘connecting’ after successfully connected through serial(usb) and after click on install. I just think the esp web tools is broken for esp8266 nodemcu…

Back to the command line with ‘esphome run…’ , I took a bare minimum(below) with wifi client and dht only;

esphome:
  name: demoflo
  platform: ESP8266
  board: nodemcuv2

wifi:
  #hostname: ${name}
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true

logger:

api:
  # encryption:
  #  key: !secret apikeywmtr1

ota:
  #password: !secret ota_password_wmtr1
  platform: esphome

switch:
  - platform: restart
    name: ${friendly_name} Restart

sensor:
  - platform: dht
    pin: D3 #GPIO5
    temperature:
      name: ${friendly_name_temp}
      filters:
        - filter_out: nan
        - heartbeat: 15s
        - sliding_window_moving_average:
            window_size: 2
            send_every: 2
            send_first_at: 1
        - lambda: return x * (9.0/5.0) + 32.0; # report temperature in Fahrenheit
      unit_of_measurement: "°F"
    humidity:
      name: ${friendly_name_humidity}
      filters:
        - filter_out: nan
        - heartbeat: 15s
        - sliding_window_moving_average:
            window_size: 2
            send_every: 2
            send_first_at: 1
      accuracy_decimals: 1 # humidity gets 0 decimals by default
    model: DHT11
    update_interval: 60s

  - platform: wifi_signal
    name: ${friendly_name} WiFi Signal Strength
    update_interval: 60s

text_sensor:
  - platform: version
    name: ${friendly_name} ESPHome Version

Now, the logging started to be readable😃.
Still could not connect to WIFI AP. Then set up a separate Old AP device with WPA2 AES. And the ESP8266 connected right away. So it had to do with my main Access Point.
Finally found the issue in my Unifi UDM Wifi Access Point, where a combination of 2,4Ghz and 5Gz was set with ‘Band Steering’. After turning Band Steering and 5Ghz off, the ESP8266 connected right away. There is an option for ‘IOT compatibility mode’ in Unifi, that sets a couple of other settings as well(like disable BSS transition), so I choose this one to be fail safe.

I see a slight difference in the esphome section of the yaml.
I had the platform separate like this:

esphome:
  name: ${name}

esp8266:
  board: nodemcuv2

In the above the platform and board are part of the esphome component.