The unprecedented demand for highly selective, real-time monitoring and low-power gas sensors used in food quality control has been driven by the increasing popularity of the Internet of Things (IoT). Herein, the self-standing perylene diimide based covalent organic framework membranes (COFMPDI-THSTZ) were prepared via liquid–liquid interfacial synthesis method. By incorporating the perylene diimide monomer into the COFM through molecular engineering, COFMPDI-THSTZ based sensor demonstrated an outstanding trimethylamine (TMA)-sensing performance at room temperature. Benefited from the TMA-accessible self-standing membrane morphology, π-electron delocalization effect, and extensive surface area with continuous nanochannels, the specific and highly sensitive TMA measurement has been achieved within the range of 0.03–400 ppm, with an exceptional theoretical detection limit as low as 10 ppb. Moreover, the primary internal mechanism of COFMPDI-THSTZ for this efficient TMA detection was investigated through in-situ FT-IR spectra, thereby directly elucidating that the chemisorption interaction of oxygen modulated the depletion layers on sensing material surface, resulting in alterations in sensor resistance upon exposure to the target gas. For practical usage, COFMPDI-THSTZ based sensor exhibited exceptional real-time in-situ sensing capabilities, further confirmed their potential for application in dynamic prediction evaluation of marine fish products and quality monitoring in IoT.