Hello,
I would do something much more simple
At the beginning of the sketch :
bool buzzerState = false;
Then at the end of your sketch where you currently have the sleep() :
if (AlarmModeIsActive) {
buzzerState = not(buzzerState); // invert state of buzzer
digitalWrite(BUZZERPIN, buzzerState);
sleep(BUZZER_PIN, CHANGE, 2000); // Sleep but put interrupt on the button so we don't have to wait for a reaction when pushing the button
}
else {
// here do normal sleep for your node
sleep(30000);
}
Of course don't forget to reset buzzer state and set buzzer pin to low when button is pressed.