kakopappa / sinric

Amazon Alexa Smart home skill / Google Home Action for ESP8266 / ESP32 / Arduino
https://sinric.com
284 stars 166 forks source link

can you explain the usage of + in this line and help me solve my error #445

Open abhinav626 opened 3 years ago

abhinav626 commented 3 years ago

Serial.println("[WSc] SetThermostatMode value: " + value);

in else if(action == "SetThermostatMode") { //Alexa, set thermostat name to mode //Alexa, set thermostat to automatic //Alexa, set kitchen to off String value = json["value"]["thermostatMode"]["value"];

      Serial.println("[WSc] SetThermostatMode value: " + value);

    }

please explain the usage of +

and when i use this for my ac to set the mode using else if(action == "SetThermostatMode") { //Alexa, set thermostat name to mode //Alexa, set thermostat to automatic //Alexa, set kitchen to off String value = json["value"]["thermostatMode"]["value"];

      Serial.println("[WSc] SetThermostatMode value: " + value);
      _**String mod= + value      
            if (mod=="COOL"){
            ac.setMode(kSamsungAcCool);
            ac.send();}
            else if(mod=="HEAT"){
            ac.setMode(kSamsungAcHeat);
            ac.send();}**_

    }

i get this error _C:\Users\DR v\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/WString.h:169:34: note: candidate expects 2 arguments, 1 provided C:\Users\DR v hema\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/WString.h:168:34: note: StringSumHelper& operator+(const StringSumHelper&, const String&) friend StringSumHelper & operator +(const StringSumHelper &lhs, const String &rhs); ^ C:\Users\DR v \AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/WString.h:168:34: note: candidate expects 2 arguments, 1 provided AC_alexa_samsungrevamp.txt:184:17: error: expected ',' or ';' before 'else' else if(mod=="HEAT"){ ^ exit status 1 no match for 'operator+' (operand type is 'String')

please help me