(Reed-Switch + control-LED) behavoiur after/during update/reboot

Hi everyone.
I use an ESP-8266-12F NodeMCU, buyable ReedSwitches (4) with cable and screws and 2 cinds of LEDs (4), red and yellow. Pins for RS: D2, D5, D6, D7, Pins for LEDs: D1, D3, D8, TX
I would like to install reed switches on my windows (2 per window => tilted - opened) and integrate them into ESPHome. Status ‘OFF’ = ‘window closed’, status ‘ON’ = window opened/tilted. Everything works well so far (values ​​and symbols, states are interpreted and displayed correctly), i.e. one LED lights up red when the window is open and one yellow when it is tilted. (I’d like to use a 2-legged RGB LED to save a pin per Window - anyone have an idea to make this happen, code-wise?)
So far so good.
For example, if I now reinstall the .yaml, restart the MCU or perform an update, then all LEDs remain off, even if a window is open/tilted, i.e. the state b e f o r e booting, etc. IS NOT the state a f t e r booting.
Can this behavior be changed so that the ‘old’ or previous states are automatically restored or the status is changed twice after or during booting to ‘wake up’ the sensor again?
I can’t close/open the relevant window every time so that the statuses are current again.
Who can help me?
Thank you very much in advance!

So long
Perlchamp

if anyone is interested in:

light:
  -platform: binary
   restore_mode: RESTORE_DEFAULT_OFF