Advanced analytical applications require smart materials and sensor systems that are able to adapt or be configured to specific tasks. Based on reversible photochemistry in nanoporous materials, we present a sensor array with a selectivity that is reversibly controlled by light irradiation. The active material of the sensor array, or electronic nose (e-nose), is based on metal–organic frameworks (MOFs) with photoresponsive fluorinated azobenzene groups that can be optically switched between their trans and cis state. By irradiation with light of different wavelengths, the trans–cis ratio can be modulated. Here we use four trans–cis values as defined states and employ a four-channel quartz-crystal microbalance for gravimetrically monitoring the molecular uptake by the MOF films. We apply the photoprogrammable e-nose to the sensing of different volatile organic compounds (VOCs) and analyze the sensor array data with simple machine-learning algorithms. When the sensor array is in a state with all sensors either in the same trans- or cis-rich state, cross-sensitivity between the analytes occurs and the classification accuracy is not ideal. ... mehrRemarkably, the VOC molecules between which the sensor array shows cross-sensitivity vary by switching the entire sensor array from trans to cis. By selectively programming the e-nose with light of different colors, each sensor exhibits a different isomer ratio and thus a different VOC affinity, based on the polarity difference between the trans- and cis-azobenzenes. In such photoprogrammed state, the cross-sensitivity is reduced and the selectivity is enhanced, so that the e-nose can perfectly identify the tested VOCs. This work demonstrates for the first time the potential of photoswitchable and thus optically configurable materials as active sensing material in an e-nose for intelligent molecular sensing. The concept is not limited to QCM-based azobenzene-MOF sensors and can also be applied to diverse sensing materials and photoswitches.