Remember that since 2013 it has been mandatory, when renting a flat or business premises, to provide the tenant with a copy of the energy efficiency certificate. By the same token, on offering or advertising the flat, it is also obligatory to show its energy rating.
The energy efficiency of a building is measured on a scale ranging from letter A (for the most efficient buildings) to G (for the least efficient).
In Madrid, I have not yet found any housing or premises with the A rating, so do not worry if your rating is lower, as the most common rating is D or E. If your property has a G rating you should not do anything, as you fulfil your obligations by providing the certificate to the tenant and/or buyer. Likewise, you are not obliged to carry out refurbishment or works in the flat to improve its rating.
However, if you want to enhance its energy rating, improvements should be made to the property’s enclosure (by fitting double-glazed windows, for example) or with regard to the facilities (changing the oil boiler, placing solar panels for heating etc.)
If these are works that can only be done by the homeowners association, try to convince the association to carry out the works, arguing that this is an improvement that will benefit everyone (by reducing energy consumption). There are public subsidies available for these types of actions: You will find further information on the IDAE website www.idae.es