Programming an automated fire extinguisher.

const int buttonPin = 2;     // smokedetector 1
 const int buttonPin2 = 3;    // smokedetector 2
 const int ledPin =  10;      // relay1
 const int ledPin2 =  11;     // relay2

You should really fix your variable to match what they actually are; the pins aren't connected to LEDs and buttons, they are connected to smoke detectors and water pumps. That's bound to cause some confusion down the road, especially if ask for further help and people start perusing your code, wondering what these LEDs are supposed to do.