 const int PIN_LED = 13;
 const int PIN_BUTTON = 0;
 
+volatile unsigned long timestamp = 0;
+volatile unsigned long singletimer = 0;
+volatile unsigned long doubletimer = 0;
+volatile unsigned long tripletimer = 0;
+
+
+int lastbuttonState = -1;
+
 Bounce debouncer = Bounce(); // Bounce is built into Homie, so you can use it without including it first
-int lastbuttonState = -1;
 
 HomieNode relayNode("relay", "relay");
 HomieNode buttonNode("button", "button");

}

void loopHandler() {
  int buttonState = debouncer.read();

  if (buttonState != lastbuttonState) {
     Serial.print("Button is now: ");
     Serial.println(buttonState ? "open" : "close");

     if (Homie.setNodeProperty(buttonNode, "open", buttonState ? "true" : "false", true)) {
       lastbuttonState = buttonState;
     } else {
       Serial.println("Sending failed");

/* WARNING: untested */

/* Some functional ideas
  Single, double and triple tap.
  Single and double tap and hold
  Single tap = regular on/off
  Single hold = dim up
  Double tap = Unknown
  Double tap and hold = dim down
  Triple tap = toggle state of onboard relay
*/

#include <Homie.h>

