It is estimated that half of the world will be under water stress by 2030. Water stress is especially strong in arid climate zones where water scarcity combined with daily temperature swings make good energy and water management a must. Attempts have been made to integrate thermal regulation and water recycling into the building structure but as separate solutions. Most waste (greaywater) treatment technologies involve multiple independent steps making them difficult to implement. The most advanced means to recycle greywater in buildings is bio-filtration but it requires large spaces to be efficient. There have been attempts to develop new greywater recycling technologies based on optics but in order to be efficient they need to adapt to variable light angles requiring large and heavy mechanical control systems. Researchers at UC Berkeley created an integrated system of filtration disinfection and organic compound removal viable in small spaces (thin building exterior walls). The invention is based on solar optics-based active panels (SOAP) for greywater reuse coupled with integrated thermal (GRIT) building control. The system uses sun light for water disinfection and can also act as a thermal mass to control daily temperature swings by absorbing heat during the day and releasing it through the night. SOAP for GRIT establishes a new exterior wall building system that can decrease substantially both water and energy use.