Henri Becquerel discovered the photovoltaic effect in the late nineteenth century, which allowed the production of electricity directly from the sun. Photovoltaic power was never used commercially for many years, since it was very inefficient at turning sunlight into electricity.

See also the entry on sunpower screen, from Heinlein's story Coventry, also published in 1940.
The first commercial solar panel was made in 1954.