Wemos R1 + D4184 Mofset + Sensor SR501 + Active Buzzer

When working with ESP8266, you need to specify Dx

alarma = digitalRead (D6);

If you want to use the notation printed on the board. If you dig down into the libraries, you will find a pins_Arduino.h file that have all these Dx defined to the GPIO pins.