In 2015 the Spanish government implemented RD 900/2015, which includes the "SUN TAX". It consists of a toll for using the main grid.
Nowadays, in 2019, Spanish government implented the RD-L 15/2018 in order to be in line with the rest of European countries.
In this new RD, there are some keys issues as the "sun tax" has been cancelled. The use of solar energy is totally legal and free. Furthermore, the administrative procedures are greatly simplified.
Solar energy is now much more accessible to all house and families.