Essentially yes, that is the goal behind solar (both photovoltaic, and concentrated thermal) and wind power.
The problem is that it's not always sunny and the wind is not always blowing.
If we can create a mini sun then we could run it 24/7 which is The simplified explanation of nuclear fusion power.
lol, probably.