We can relate the hydroelectric power with sun one the basis of hydrologic cycle.
The solar energy obtained from sun heats up water on earth (oceans) and evaporates it. This water condense into clouds. The clouds precipitate out water in the form of rain or snow. This snow remains on mountains and thus solar energy is responsible for the potential energy of water on mountains which is then converted to kinetic energy and this is used as hydroelectric power.
The water present on mountains in rivers or as snow reach back to oceans and this is how the cycle completes known as hdrologic cycle.