Large amount of wastewater is produced by washing machines and dishwashers, which are used in a daily basis. This domestic wastewater generated in households or office buildings (also called greywater) is drained directly to the drainpipes without differentiation from that with fecal contamination from toilets. Detergents are arguably the pollutants most frequently found in greywater from home appliances. Their concentrations vary in the successive stages in a wash cycle, which could be taken into account in a rational design of home appliances wastewater management. Analytical chemistry procedures are commonly used to determine the pollutant content in wastewater. They require collecting samples and their transport to properly equipped laboratories, which hampers real time wastewater management. In this paper, optofluidic devices based on planar Fabry-Perot microresonators operating in transmission mode in the visible and near infrared spectral ranges have been studied to determine the concentration of five brands of soap dissolved in water. It is found that the spectral positions of the optical resonances redshift when the soap concentration increases in the corresponding solutions. Experimental calibration curves of the optofluidic device were used to determine the soap concentration of wastewater from the successive stages of a washing machine wash cycle either loaded with garments or unloaded. Interestingly, the analysis of the optical sensor indicated that the greywater from the last water discharge of the wash cycle could be reused for gardening or agriculture. The integration of this kind of microfluidic devices into the home appliances design could lead to reduce our hydric environmental impact.