       Serial.println("Released");
       function = 0;
     }
+  // Rate limit...
+
   }
 
   delay(5);

  // These are repeat events, where the button is being held down.
  // Handle them, but don't reset function back to 0 unless the button is released.
  if ( function < 0 ) {
    if ( function == -1 ) {
      Homie.setNodeProperty(buttonNode, "event", "SINGLEHELD", 0);
      Serial.println("SINGLE LONG click");
    }

    if ( function == -2 ) {
      Homie.setNodeProperty(buttonNode, "event", "DOUBLEHELD", 0);
      Serial.println("DOUBLE LONG click");
    }

    if ( function == -3 ) {
      Homie.setNodeProperty(buttonNode, "event", "TRIPLEHELD", 0);
      Serial.println("TRIPLE LONG click");
    }

    // Decide whether the button is being held or not

const int PIN_BUTTON = 0;

int function = 0;

// Timer related for dimming delays
unsigned long previousMillis = 0;
// Milliseconds to wait per cycle for a held command.
const int waitInterval = 100;

// Associate the PIN_BUTTON GPIO with the ClickButton library
ClickButton button1(PIN_BUTTON, LOW, CLICKBTN_PULLUP);
