The present invention relates to a method and a device for detecting the type of opening on which a detection device is installed, the opening being an opening of the three-state or two-state type. The detection device comprises an oscillator whose frequency varies as a function of the proximity of a metallic element of a device for setting the opening in different states. The detection device: - measures (E801) the frequency of the oscillator of the detection device at a first predetermined rate, - checks (E802) from the measured frequency, whether the opening has passed from a state to a other state, - increments (E806) a counter if the other state corresponds to the opening state of the opening, - determines (E810), if the value of the counter is equal to the predetermined value, if among the frequencies measured, a majority of the frequencies are distributed in two or three distinct frequency ranges, - detects (E810, E812) the type of opening as a function of the number of distinct frequency ranges determined.
展开▼