Rail-mounted building automation device comprising a communication module with a communications bus (1.1) of the device, an application module that implements the functionality of the device, and a bus connector between the two modules (1,2), said bus connector is for power supply and data transfer, characterized in that the communication module comprising a first casing (1.2) composed of an upper body (1.3) with a first front wall (1.4) and a first rear wall (1.5) from which at least ten pins (3.1) of the bus connector project, and a lower body (1.6) with a second front wall ( 1.7) having a first recess (1.8) in which the communications bus (1.1) is inserted and a second rear wall (1.9), so that the first front wall (1.4) is further forward than the second front wall (1.7) with respect to the application module when the modules are fully assembled together and prepared for use, and the first rear wall (1.5) is also further forward than the second rear wall (1.9) with respect to the application module when the modules are fully assembled together and prepared for use, the application module comprising a second casing (2.1) with a first protrusion (2.2) comprising a second recess (2.3) and a third recess (2.4) with a third front wall (2.5) from which a receiving connector (3.2) for the bus connector pins projects, a fourth front wall (2.6) having a fourth centered recess (2.7) that includes first electrical connection terminals, a fifth front wall (2.8) having a fifth centered recess (2.9) and respective sixth (2.10) and seventh recesses (2.11), these sixth (2.10) and seventh recesses (2.11) including second and third terminals respectively, at least a first projection (2.12) facing a second projection (2.13), both projections (2.12,2.13) being separated at approximately the width of the rail on which the device can be placed, the modules being fully assembled together and prepared for use when the at least ten pins (3.1) of the bus connector are introduced in the receiving connector (3.2) the upper body (1.3) is introduced in the third recess (2.4) and the lower body (1.6) in the fifth recess (2.9) and the first casing (1.2) is joined to the second casing (2.1) by securing means. characterized in that the communication module comprising a first casing (1.2) composed of an upper body (1.3) with a first front wall (1.4) and a first rear wall (1.5) from which at least ten pins (3.1) of the bus connector project, and a lower body (1.6) with a second front wall ( 1.7) having a first recess (1.8) in which the communications bus (1.1) is inserted and a second rear wall (1.9), so that the first front wall (1.4) is further forward than the second front wall (1.7) with respect to the application module when the modules are fully assembled together and prepared for use, and the first rear wall (1.5) is also further forward than the second rear wall (1.9) with respect to the application module when the modules are fully assembled together and prepared for use, the application module comprising a second casing (2.1) with a first protrusion (2.2) comprising a second recess (2.3) and a third recess (2.4) with a third front wall (2.5) from which a receiving connector (3.2) for the bus connector pins projects, a fourth front wall (2.6) having a fourth centered recess (2.7) that includes first electrical connection terminals, a fifth front wall (2.8) having a fifth centered recess (2.9) and respective sixth (2.10) and seventh recesses (2.11), these sixth (2.10) and seventh recesses (2.11) including second and third terminals respectively, at least a first projection (2.12) facing a second projection (2.13), both projections (2.12,2.13) being separated at approximately the width of the rail on which the device can be placed, the modules being fully assembled together and prepared for use when the at least ten pins (3.1) of the bus connector are introduced in the receiving connector (3.2) the upper body (1.3) is introduced in the third recess (2.4) and the lower body (1.6) in the fifth recess (2.9) and the first casing (1.2) is joined to the second casing (2.1) by securing means.