Automation last boot

Hello, I ask you. I want to do an automation that when the raspberry turns off and then loads the HA, certain lights turn off.
I want this because I have two lights in my house that do not maintain their status and when the light goes out they come back on and it occurred to me to do an automation that when it detects that the sensor that marks me how long the raspberry has been active is less than 5 min. turn off the lights. How can I do it?

Thanks in advance

You have specific HA automation triggers for that: