A dimmer connectable to an AC power source in a 2-wire mode or in a 3-wire mode, the dimmer being further connectable to a load, the AC power source comprising a first terminal, a second terminal and a neutral, the dimmer comprising: - a switch unit comprising a first switch and a second switch coupled in series, with a node between the first switch and the second switch coupled to signal ground; - a line terminal for electrically coupling the first switch to the first terminal of the AC power source; - a switched line terminal for electrically coupling the second switch to a first terminal of the load, wherein a second terminal of the load is connectable to the second terminal of the AC power source; - a second resistive element coupled in series in a path going from the switched line terminal over the second switch to the signal ground, and/or a first resistive element coupled in series in a path going from the line terminal over the first switch to the signal ground; characterized in that: - the dimmer further comprises a neutral terminal for electrically coupling the dimmer to the neutral of the AC power source in the 3-wire mode, wherein in the 3-wire mode: i) the second terminal of the load is further connectable to the neutral of the AC power source and ii) the AC power source is connectable between the line terminal and the neutral terminal, such that, in operation, power for the dimmer flows through a direct path between the line terminal and the neutral terminal; - the dimmer further comprising a connectivity detector adapted for obtaining a signal from the second resistive element and/or a signal from the first resistive element and for determining, based on the obtained signals, whether the dimmer is connected to the AC power source in the 2-wire or in the 3-wire mode, wherein the connectivity detector comprises at least one comparator adapted for comparing the obtained signal of the first resistive element and/or the obtained signal of the second resistive element with at least one pre-defined value and/or with regard to each other to determine whether the dimmer is connected in 2-wire or in 3-wire mode. - a switch unit comprising a first switch and a second switch coupled in series, with a node between the first switch and the second switch coupled to signal ground; - a line terminal for electrically coupling the first switch to the first terminal of the AC power source; - a switched line terminal for electrically coupling the second switch to a first terminal of the load, wherein a second terminal of the load is connectable to the second terminal of the AC power source; - a second resistive element coupled in series in a path going from the switched line terminal over the second switch to the signal ground, and/or a first resistive element coupled in series in a path going from the line terminal over the first switch to the signal ground; - the dimmer further comprises a neutral terminal for electrically coupling the dimmer to the neutral of the AC power source in the 3-wire mode, wherein in the 3-wire mode: i) the second terminal of the load is further connectable to the neutral of the AC power source and ii) the AC power source is connectable between the line terminal and the neutral terminal, such that, in operation, power for the dimmer flows through a direct path between the line terminal and the neutral terminal; - the dimmer further comprising a connectivity detector adapted for obtaining a signal from the second resistive element and/or a signal from the first resistive element and for determining, based on the obtained signals, whether the dimmer is connected to the AC power source in the 2-wire or in the 3-wire mode, wherein the connectivity detector comprises at least one comparator adapted for comparing the obtained signal of the first resistive element and/or the obtained signal of the second resistive element with at least one pre-defined value and/or with regard to each other to determine whether the dimmer is connected in 2-wire or in 3-wire mode.