 
 const int CMD_WAIT = 0;
 const int CMD_BUTTON_CHANGE = 1;
+const int CMD_INPUT_CHANGE = 2;
 
 int cmd = CMD_WAIT;
 //int relayState = HIGH;

        buttonState = currentState;
      }
      break;
  }


}





  pinMode(SONOFF_BUTTON, INPUT);
  attachInterrupt(SONOFF_BUTTON, toggleState, CHANGE);

  //setup input
  pinMode(SONOFF_INPUT, INPUT);
  attachInterrupt(SONOFF_BUTTON, toggleInputState, CHANGE);

  //setup relay
  //TODO multiple relays
  pinMode(SONOFF_RELAY_PINS[0], OUTPUT);
