 void loop()
 { // Main execution loop
 
+ if (beepEnabled){                                        // Process Beeps
+    if((beepState == true) && (millis() - previousMillis >= OnTime) && ((beepCounter > 0)))
+    {
+      beepState = false;                                   // Turn it off
+      previousMillis = millis();                           // Remember the time
+      analogWrite(beepPin, 254);                           // start beep for OnTime
+      if(beepCounter > 0){beepCounter--;}                  // Update the beep counter.
+    }
+    else if ((beepState == false) && (millis() - previousMillis >= OffTime) && ((beepCounter >= 0)))
+    {
+      beepState = true;                                    // turn it on
+      previousMillis = millis();                           // Remember the time
+      analogWrite(beepPin, 0);                             // stop beep for OffTime
+    }
+  }
+
   if (nextionHandleInput())
   { // Process user input from HMI
     nextionProcessInput();

const unsigned long telnetInputMax = 128;           // Size of user input buffer for user telnet session
bool motionEnabled = false;                         // Motion sensor is enabled
bool mdnsEnabled = true;                            // mDNS enabled
bool beepEnabled = true;
uint8_t motionPin = 0;                              // GPIO input pin for motion sensor if connected and enabled
bool motionActive = false;                          // Motion is being detected
const unsigned long motionLatchTimeout = 30000;     // Latch time for motion sensor

    configClearSaved();
  }
  else if (strTopic == (mqttCommandTopic + "/beep") || strTopic == (mqttGroupCommandTopic + "/beep"))
  { // '[...]/device/command/beep')
    String mqqtvar1 = getValue( strPayload, ',', 0);
    String mqqtvar2 = getValue( strPayload, ',',1);
    String mqqtvar3 = getValue( strPayload, ',',2);
    
    OnTime = mqqtvar1.toInt();
    OffTime = mqqtvar2.toInt();
    beepCounter = mqqtvar3.toInt();
   
  }
  else if (strTopic.startsWith(mqttCommandTopic) && (strPayload == ""))
  { // '[...]/device/command/p[1].b[4].txt' -m '' == nextionGetAttr("p[1].b[4].txt")
