I am building a RC car with a Raspberry Pi 3, and I would like to power the Raspberry with a battery. However, when the Raspberry is off, I would like to switch from the battery powering the Raspberry, to the battery being powered by a photovoltaic cell.
The battery has only two wires through which you can charge or discharge it. In this case, I cannot charge the battery while it is discharging.
Considering that even when shut down, Raspberry Pi draws some current, how could I determine that the Raspberry has turned off, so I can switch off power between the battery and Raspberry, and switch on power between the solar cell and battery?