Alexa.cpp
/**************************************************
 *  
 *                 ADD DEVICES SECTION
 *                 
 *   The default state is OFF              
 *                 
 *   You can add a third parameter as starting state
 *   It must be an integer between 0 (min) and 255 (max).
 *   
 *   ex: espalexa.addDevice(DEVICE_01, device_01, 128);
 *   here the device would be at 50% unless indicated
 *   otherwise by voice command
 * 
 * 
 **************************************************/
ADD DEVICES SECTION

The default state is OFF

You can add a third parameter as starting state
It must be an integer between 0 (min) and 255 (max).

espalexa.addDevice(DEVICE_01, device_01, 128);
here the device would be at 50% unless indicated
otherwise by voice command
ADD DEVICES SECTION The default state is OFF You can add a third parameter as starting state It must be an integer between 0 ( min ) and 255 ( max ) . espalexa . addDevice ( DEVICE_01 device_01 128 ) ; here the device would be at 50% unless indicated otherwise by voice command
void AlexaSetup::initializeDevices(){
    isOn=wifi.wifiIsOn();
    if(isOn){
    #ifdef DEVICE_01
      palexa.addDevice(DEVICE_01, device_01);
    #endif
        #ifdef DEVICE_02
      palexa.addDevice(DEVICE_02, device_02);
    #endif
        #ifdef DEVICE_03
      palexa.addDevice(DEVICE_03, device_03);
    #endif
        #ifdef DEVICE_04
      palexa.addDevice(DEVICE_04, device_04);
    #endif
        #ifdef DEVICE_05
      palexa.addDevice(DEVICE_05, device_05);
    #endif
    #ifdef DEVICE_06
      palexa.addDevice(DEVICE_06, device_06);
    #endif
        #ifdef DEVICE_07
      palexa.addDevice(DEVICE_07, device_07);
    #endif
        #ifdef DEVICE_08
      palexa.addDevice(DEVICE_08, device_08);
    #endif
        #ifdef DEVICE_09
      palexa.addDevice(DEVICE_09, device_09);
    #endif
        #ifdef DEVICE_10
      palexa.addDevice(DEVICE_10, device_10);
    #endif
    #ifdef DEVICE_11
      palexa.addDevice(DEVICE_11, device_11);
    #endif
        #ifdef DEVICE_12
      palexa.addDevice(DEVICE_12, device_12);
    #endif
        #ifdef DEVICE_13
      palexa.addDevice(DEVICE_13, device_13);
    #endif
        #ifdef DEVICE_14
      palexa.addDevice(DEVICE_14, device_14);
    #endif
        #ifdef DEVICE_15
      palexa.addDevice(DEVICE_15, device_15);
    #endif
    #ifdef DEVICE_16
      palexa.addDevice(DEVICE_16, device_16);
    #endif
        #ifdef DEVICE_17
      palexa.addDevice(DEVICE_17, device_17);
    #endif
        #ifdef DEVICE_18
      palexa.addDevice(DEVICE_18, device_18);
    #endif
        #ifdef DEVICE_19
      palexa.addDevice(DEVICE_19, device_19);
    #endif
        #ifdef DEVICE_20
      palexa.addDevice(DEVICE_20, device_20);
    #endif
      palexa.begin();
    }else {
    while (1) {
      Serial.println("Cannot connect to WiFi. Please check data and reset the ESP.");
      delay(2500);
    }
  }
  }
void AlexaSetup :: initializeDevices ( ) { isOn = wifi . wifiIsOn ( ) ; if ( isOn ) { #ifdef DEVICE_01 palexa . addDevice ( DEVICE_01 , device_01 ) ; #endif #ifdef DEVICE_02 palexa . addDevice ( DEVICE_02 , device_02 ) ; #endif #ifdef DEVICE_03 palexa . addDevice ( DEVICE_03 , device_03 ) ; #endif #ifdef DEVICE_04 palexa . addDevice ( DEVICE_04 , device_04 ) ; #endif #ifdef DEVICE_05 palexa . addDevice ( DEVICE_05 , device_05 ) ; #endif #ifdef DEVICE_06 palexa . addDevice ( DEVICE_06 , device_06 ) ; #endif #ifdef DEVICE_07 palexa . addDevice ( DEVICE_07 , device_07 ) ; #endif #ifdef DEVICE_08 palexa . addDevice ( DEVICE_08 , device_08 ) ; #endif #ifdef DEVICE_09 palexa . addDevice ( DEVICE_09 , device_09 ) ; #endif #ifdef DEVICE_10 palexa . addDevice ( DEVICE_10 , device_10 ) ; #endif #ifdef DEVICE_11 palexa . addDevice ( DEVICE_11 , device_11 ) ; #endif #ifdef DEVICE_12 palexa . addDevice ( DEVICE_12 , device_12 ) ; #endif #ifdef DEVICE_13 palexa . addDevice ( DEVICE_13 , device_13 ) ; #endif #ifdef DEVICE_14 palexa . addDevice ( DEVICE_14 , device_14 ) ; #endif #ifdef DEVICE_15 palexa . addDevice ( DEVICE_15 , device_15 ) ; #endif #ifdef DEVICE_16 palexa . addDevice ( DEVICE_16 , device_16 ) ; #endif #ifdef DEVICE_17 palexa . addDevice ( DEVICE_17 , device_17 ) ; #endif #ifdef DEVICE_18 palexa . addDevice ( DEVICE_18 , device_18 ) ; #endif #ifdef DEVICE_19 palexa . addDevice ( DEVICE_19 , device_19 ) ; #endif #ifdef DEVICE_20 palexa . addDevice ( DEVICE_20 , device_20 ) ; #endif palexa . begin ( ) ; } else { while ( 1 ) { Serial . println ( " " ) ; delay ( 2500 ) ; } } }
ADD DEVICES SECTION
ADD DEVICES SECTION