 AFEMQTT Mqtt;
 AFEWebServer WebServer;
 AFELED Led;
-AFESwitch Switch;
+AFESwitch Switch[5];
 AFESwitch ExternalSwitch;
-AFERelay Relay;
+AFERelay Relay[4];
 MQTT MQTTConfiguration;
-AFEPIR Pir;
+AFEPIR Pir[4];
 
 void setup() {
 

          }
        }

        /* Relay related code */
        if (Device.configuration.isRelay[0]) {

          /* One of the switches has been shortly pressed */
          if (Switch.isPressed() || ExternalSwitch.isPressed()) {
            Led.on();
            Relay.toggle();
            MQTTPublishRelayState(); // MQTT Listener library
            Led.off();
          }
        }

        if (Device.configuration.isPIR[0]) {
          if (Pir.stateChanged()) {
            if (Pir.getState()) {
              Relay.on();
            } else {
              Relay.off();
            }
          }
        }

  }

  /* Initializing relay and setting it's default state at power on*/
  if (Device.getMode() == MODE_NORMAL) {
    for (uint8_t i = 0; i < 4; i++) {
      if (Device.configuration.isRelay[i]) {
        Relay[i].begin(i);
        Relay[i].setRelayAfterRestoringPower();
      }
    }
  }

  /* Initialzing network */
