Light - Restore_mode and random reboots

Hello! I have a 8 recessed lights with Esphome on them. I want them to work as normal lights if for some reason my network is down. I normally toggle it via wifi, so the switch stays on. It works great, no issues, light turns on with the switch.

The issue is, randomly the device reboots on its own, so it turns on for no reason. Is there a way to prevent the light turning on from these random reboots?

I am assuming the reboot is due to this FAQ: " ESPHome reboots on purpose when something is not going right, e.g. wifi connection cannot be made or api connection is lost or mqtt connection is lost. So if you are facing this problem you’ll need to explicitly set the reboot_timeout option to 0s on the components being used.

"

esphome:
  on_boot:
    priority: 600
    then:
      - light.turn_on:
          id: light
          brightness: 80%
          color_temperature: 3200K

and

light:
  - platform: rgbww
    id: light
    name: light
    color_interlock: true
    cold_white_color_temperature: 6500 K
    warm_white_color_temperature: 2700 K
    red: output_red
    green: output_green
    blue: output_blue
    cold_white: output_cold
    warm_white: output_warm
    restore_mode: RESTORE_AND_ON

You are explicitly turning the light on after each reboot…

The restore mode you chose to use will attempt to restore previous state and initialize it as On if it cant restore last state.

Loose the entire on_boot automation. Its all completely unnecessary and not what its meant to be used for. Case and point, its contradicting your light restore mode setting. If it restores its previous state as Off, then here comes your on_boot automation and turns it On, overwriting restore mode.

Thank you. That makes sense.

My only concern is if for some reason my system is down, I want to be able to turn on the lights via power cycle still with the switch. If I do restore state, they will stay off during power cycle via the switch if they were previously off.

If the state was Off prior to your system/wifi coming back online then the light will start in the Off state or On if the light was On instead.

Keeping the light On during a reboot depends on how the light is being controlled. Is this an esp w/relay or what are you using?

I am not worried about the light staying on during reboot. I am just wanting to ensure the light turns on if the power cycle was caused by actual power cut and turned back on.

Essentially, I am wondering if there is a way to distinct between a power reset vs a reboot on the on_boot section.

It is just a generic tuya recessed light flashed with esphome.
https://www.amazon.com/Amico-Bluetooth-Downlight-2700-6500K-Assistant/dp/B0C658GXRY/

So if the light is Off and you lose power, you want the light to turn On aftet it starts up but, if you manually restart it then you want it to restore whatever its last state was?

What does the documentation for Light Restore modes say?