A method for replacing an existing switch or dimmer (710', 810') in an existing two-way switching circuit having a phase line and a neutral of mains (780, 781, 880, 881) of a building with a smart device, the existing two-way switching circuit comprising said existing switch or dimmer (710', 810') and an other switch (710; 800, 810) connected via existing wiring(720; 820), the method comprising the following steps: - removing the existing switch or dimmer (710', 810') from a wall box where cables to a lamp are located; - placing the smart device in said wall box; the smart device comprising: a base comprising an electrical part configured for being at least partially built-in in a wall of the building and configured for being directly connected, in a wall, to electrical wires present in the wall of the building; a communication part on said base; a microcontroller on said base connected to the communication part and to said electrical part, said microcontroller being configured for processing data received by the communication part and for configuring or operating the electrical part accordingly; and for sending data via said communication part; - replacing the other existing switch with a new switch (730; 750; 830, 830'; 850, 850') which is capable of providing the smart device with a signal when said new switch is being operated by a user; and - changing the wiring diagram using the existing wiring ((a), (b), (c); (a), (b), (c), (e), (f)); wherein the step of replacing the other existing switch comprises adding a new wired switch (730; 830, 830') and wherein the step of changing the wiring diagram comprises connecting the communication part via the existing wiring ((b)) to the new wired switch (730; 830, 830'); or wherein the step of replacing the other existing switch comprises adding a new switch (750; 850, 850') configured to communicate wirelessly in a direct manner with the communication part of the smart device; and wherein the step of changing the wiring comprises connecting a short (740; 840) for connecting the single phase line of the mains (780, 781, 880, 881) where the other existing switch has been removed; wherein the smart device is a smart dimmer and the electrical part has a controllable dimming function; or wherein the smart device is a smart switch and the electrical part has a controllable switching function. - removing the existing switch or dimmer (710', 810') from a wall box where cables to a lamp are located; - placing the smart device in said wall box; the smart device comprising: a base comprising an electrical part configured for being at least partially built-in in a wall of the building and configured for being directly connected, in a wall, to electrical wires present in the wall of the building; a communication part on said base; a microcontroller on said base connected to the communication part and to said electrical part, said microcontroller being configured for processing data received by the communication part and for configuring or operating the electrical part accordingly; and for sending data via said communication part; a base comprising an electrical part configured for being at least partially built-in in a wall of the building and configured for being directly connected, in a wall, to electrical wires present in the wall of the building; a communication part on said base; a microcontroller on said base connected to the communication part and to said electrical part, said microcontroller being configured for processing data received by the communication part and for configuring or operating the electrical part accordingly; and for sending data via said communication part; - replacing the other existing switch with a new switch (730; 750; 830, 830'; 850, 850') which is capable of providing the smart device with a signal when said new switch is being operated by a user; and - changing the wiring diagram using the existing wiring ((a), (b), (c); (a), (b), (c), (e), (f)); wherein the step of replacing the other existing switch comprises adding a new wired switch (730; 830, 830') and wherein the step of changing the wiring diagram comprises connecting the communication part via the existing wiring ((b)) to the new wired switch (730; 830, 830'); or