Random actions, untriggered by IFTTT

My project works, but fustratingly I’m it also gets activated at random and I can’t work out why. Any experience or advice gratefully received.

I’m using IFTTT to take instructions from Amazon Alexa, and link to a Particle Photon. The code works fine, with voice controls being sent to IFTTT and triggering the IFTTT Applet, as shown in the IFTTT log. However, I also get random actions triggered every hour or so and I can’t work out why. There’s no trace of them in the Alexa or IFTTT logs, and the Particle Log only seems to show events published by the Photon, not actions triggered by IFTTT.

My code is pretty innocuous, with setup subscribing to the appropriate IFTTT Applets:

    Particle.subscribe("doorClose", closeTheDoor);
    Particle.subscribe("doorOpen", openTheDoor);

…and subroutines that just lift specific pins (which in turn throw relays):

void closeTheDoor(const char *event, const char *data) {
    digitalWrite(closeDoor, HIGH);
    delay(24000);
    digitalWrite(closeDoor, LOW);
}


void openTheDoor(const char *event, const char *data) {
    digitalWrite(openDoor, HIGH);
    delay(24000);
    digitalWrite(openDoor, LOW);
}

…happy to provide more details, but any advice or pointers for places to look would be greatly appreciated.

Bill.

You probably want to change this to:

Particle.subscribe("doorClose", closeTheDoor, MY_DEVICES);
Particle.subscribe("doorOpen", openTheDoor, MY_DEVICES);

Otherwise, anyone in the world who publishes a public event that begins with "doorOpen" or "doorClose" will trigger your door.

MY_DEVICES will limit the subscription to other Particle devices in your account, as well as API calls on behalf of your account, including the Particle CLI (using the --private option) and IFTTT (make sure you set the event to private in IFTTT).

6 Likes

I perfect answer: that has fixed the problem entirely. I was really struggling to see how it could be happening, but your response makes perfect sense.

I would have posted this earlier, but I wanted to leave it over night to be certain that the problem had gone away, which it has.

Thanks loads, very much appreciated.

Bill.

2 Likes