This must be a really really common problem and the only reason it is diffi cult to find on youtube is the wrong search terms:
If a device has a power on button latch switch and you want it to turn on a nd off like a light bulb, i. e., when the power supply is plugged in or a r elay connects the power, or for solar, when the sun comes up, is it a commo n solution to run a wire from the power supply through a cap and maybe a la rge drain resister in parallel then to one side of the latch switch?
The current would flow through the cap just long enough to set the latch sw itch before the cap is charged and stops the flow.
Then the device turns on and stays on until power is disconnected. The pro cess can repeat after the charge drains off the cap.
First check the voltage through the on switch is the same as the power supp ly. (This will not werk on a lap top.)
I'd need some idea of the time it takes to latch and some thresh hold volta ge for the latch to select the cap and resister. Maybe look at it on an os cilloscope.