IFTTT sends untriggered responses at random times

I am using a particle photon and this code:
to send an email and an SMS. This works as expected except that I am getting false positive responses at seemingly random times. Typically there are no false positives for 2-4 days then there is a day with 3-6 false positives. Here are data from yesterday:
photon1 published Done at January 26, 2016 at 08:24PM
photon1 published Done at January 26, 2016 at 09:51PM
photon1 published Done at January 26, 2016 at 11:26PM
photon1 published Done at January 27, 2016 at 12:07AM

The only pattern I see here is roughly 30 minute intervals (except between 8:24 and 9:51. The action times agree on both email and SMS. The IFTTT log does not yet show exact times.

I have cycled both photon power supply and WiFi router power supplies and never get any false positives. Photon is located in the garage and temps are in the 40s F.

Anyone else having this problem? Any troubleshooting ideas?

What are the conditions to trigger the publish?
Could it be a floating signal?

To eliminate that possibility, I disconnected the sensor and I am still getting random actions. Next step is to comment out the publish statement.

Keep the ideas coming ScruffR
Stay tuned for more exciting action(s)!

Got some code to look at and also some info about the IFTTT recipe?
Do you see actual events on the Particle dashboard too, or only via IFTTT?

Here is the code that was working on Arduino and adapted to Photon publish:

button pin 0 is tied to gnd through 10K resistor, goes high when switch is pressed.
dryer pin 4 is attached to hall switch sensor which has always worked in the past and has been tested
at both 5V and 3.3V.  It is now working as expected at 3.3V.
// user defined global variables from laundry sketch
const int buttonPin = 0;  // the number of the pushbutton pin
const int  dryerPin = 4;  // dryer hall switch pin
//const int washerPin = 6;  // washer not coded yet
const int  LEDpin = 7;    // LED to signal humans
unsigned long maxDurationLimit = 10760; // 30% tolerance for duration, note 10% does NOT work
unsigned long minDurationLimit = 5800;  // 30% tolerance for duration
unsigned long duration;                 // duration of 60 Hz pulse, typically 8280 microseconds
int buttonState = 0;    // variable for reading the pushbutton status
int dryerState = 0;     // current state of the dryer, set to zero=off
int lastDryerState = 0; // previous state of the dryer, set to zero=off
void setup(void) // ************************************************************** setup*  *************************************************
  Serial1.begin(9600);  // Set up the serial port connection. // <<<<<<<<<<<<<<<<< debug only <<<<<<<<<<<<<<<<<<<<<
  pinMode(dryerPin, INPUT);  // for future use, initialize the dryer pin as an input from hall switch
  pinMode(LEDpin, OUTPUT);     // initialize the LED cycle pin as an output
  pinMode(buttonPin, INPUT);  // initialize the pushbutton pin as an input
  Serial1.println("Ready");    // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< debug only <<<<<<<<<<<<<<<<<<
void loop(void)  // **************************************************************  loop *****************************************
  // see if there is 60 hz current on the dryer, if so then dryer state is on (=1)
  duration = pulseIn(dryerPin, HIGH);
  if ( (duration > minDurationLimit) && (duration < maxDurationLimit))
  { // 60 Hz = 8280 us, look for anything within  a percentage  of 8280
    dryerState = 1; // duration reading is within limits, so there must be 60 hz current
 { // no 60 Hz so  must be off
    dryerState = 0; // off condition, no 60 hz current
    digitalWrite (dryerPin, LOW);
   buttonState = digitalRead(buttonPin);   // read the state of the pushbutton
  //Serial1.println(buttonState);  // <<<<<<<<<<<<<<<<< debug only <<<<<<<<<<<<<<<<<<<<<
  // look for dryer turned off or button press
  if (((lastDryerState == 1) && (dryerState == 0)) || (buttonState == HIGH))  // if dryer state is zero, then we are truly finished
    digitalWrite(LEDpin, HIGH);   // turn LED on to show publish action 
    // this is where the action is...send email when event name Dryer, event contents Done, Device name Photon1
    Serial1.println(">>>> msg sent");  // <<<<<<<<<<<<<<<<< debug only <<<<<<<<<<<<<<<<<<<<<
    delay (500);
    digitalWrite(LEDpin, LOW);  // turn LED off
   }  //end of dryer readings
  lastDryerState = dryerState;   // save dryer state for comparison later
  delay (1000);                  // 1000 is one second for each loop

I am Photon noob. No CLI, no Dashboard. I use only online IDE
IFTTT recipe is: If Photon1 publishes Dryer, then send me an email at …

I have flashed code removing all sensor (but not button) input. Button works as it always has before. I will wait a few days to see what happens.

Off subject: Is there a way to format code in the online IDE (similar to Arduino’s CTRL-t ?

Thanks for your input, ScruffeR

To check your events you can either use


or your browser’s view-source capabilities

For Chrome e.g


BTW: On the Particle devices try to use the D0D7 and A0A7 notation instead of the numeric-only way. Just use the names printed on the silk screen of the device.

For buttons you should always add a pull-resistor to prevent floating pins

// instead of
pinMode(buttonPin, INPUT);  // initialize the pushbutton pin as an input
// try
pinMode(buttonPin, INPUT_PULLUP); // if button connects to GND
// or 
pinMode(buttonPin, INPUT_PULLDOWN); // if button connects to 3V3 or Vin

I’d guess this might well have been the reason for your false triggers.