How quickly will ESPHome boot and start run items in on_boot?

I want to add a safety feature to my current project and could do it in hardware or software. I’m finding that, when I upload a new YAML file to my ESP32, it can take 1-2 minutes (I’ve timed it) after the upload for it to reboot and for me to start seeing log entries on the ESPHome addon in HA. I don’t know if this is a communication issue or a boot issue.

In general, how long will it take ESPHome to boot and get to something I have in on_boot when power to it is turned on? (This function would need to read one GPIO input and, depending on its state at boot, turn another GPIO pin on or off.)

Someone else might know more precisely but it should only take seconds for ESPHome to boot and be able to do local tasks like flash an LED.

Connecting to wifi/the api takes longer. But maybe like circa 5 ses if things are working ok.

You’ll see for battery powered deep sleep projects people want fast boots and api connects. There’s lots of posts on tricks to make that happen a bit quicker.

Interesting and quite believable that the delay I see is about communications, not about booting.

So if I use on_boot to pull a GPIO line high or low, that should be active within, say, 5 seconds or so? I’m also thinking through what I have connected and the hardware. The biggest issue is the etching laser. 5 seconds is enough time for it to start burning a hole in the CNC wasteboard or, if it was positioned in just the wrong place, hitting the metal fasteners. I don’t know if reflection of the beam would be an issue or not. I’m also thinking how quickly the laser itself would take to start up.

I suspect your talking in the order of 2 seconds for a gpio. I would test with something.

I’m no expert in theses things, but it seems like quite a critical application, and for that you probably shouldn’t rely on “software interlocking”? You mentioned dealing with it with hardware, which seems safer to me?

Depending on your implementation there is also the restore_mode for some switches that you might be able to leverage.

That’s my thinking: Go with what has a better chance of working quickly and working every time. I’ve found some help and it’s going to be simple to make a circuit that will not let the power on the control board go on (other than for the ESP32) until the main switch goes off. So if it’s off when it starts up, no problem. If not, it won’t power up until the switch goes off. Then it can go on and work okay.

1 Like