IFTTT Not working anymore

I am no longer able to use IFTTT after I was successfully able to use it with another project. I went to create a new small project and cannot interact with IFTTT. I did notice that it is no longer the Spark channel, but rather the Particle channel. I disconnected and reconnected to the particle channel. My function are showing up, but i cannot get them to trigger when sending a text to them, like I could in the past.

I have read the posts regarding the fix and have tried everything on there with no luck. Any help will be much appreciated. Code below. THANK YOU!!

    int relay = D1;
int lightOn(String command);
int lightOff(String command);
int led = D4;
void setup() {
    Spark.function("on", lightOn);
    Spark.function("off", lightOff);
    pinMode(relay, OUTPUT);
    pinMode(led, OUTPUT);
    

}

void loop() {
    /*
    digitalWrite(relay,HIGH);
    delay(2000);
    digitalWrite(relay, LOW);
    */
 
    
}

int lightOn(String command)
{
        if(command == "on")
        {
            digitalWrite(relay,HIGH);
            digitalWrite(led,HIGH);    
            
        }
}

int lightOff(String command)
{
        if(command == "off")
        {
            digitalWrite(relay, LOW);
            digitalWrite(led,LOW);
        }
}
Please use this format to post code in discourse:
``` <-- insert this code

//paste code here

``` <-- insert this code

Try recreating the recipe again.

Thank you for your reply. I have tried a couple times. Even tried signing out and signing in, also tried clearing core and running setup again.

Hi @danlee6992,

Make sure your Spark.functions return a value, and that your device is online. Can you tell me any more about your recipe, or when it wasn’t working? I can check the logs and try to see what’s up. :slight_smile:

Thanks,
David

Thank you Dave!! After a few frustrating hours, I removed the function parameter to what the parameter I was passing in through IFTTT and got rid of the if statement. That seemed to work.

This is the new code that worked:
My apologies if it’s not formatted as I’m in the car. on is the parameter I’m passing in IFTTT.

int lightOn(String on)
{
        digitalWrite(relay,HIGH);
        digitalWrite(led,HIGH);    
}
1 Like

Hi @danlee6992,

I’m glad you got it working!

Thanks,
David