How to limit publish to IFTTT only once everyday?


#1

Hello,
I have a photon project which publishes an event(send an email) when I shake vibration sensor. I just want it detects the action of sensor once a day? What ways I can do?

Thanks


#2

Use a timer perhaps? Look for SparkIntervalTimer library.


#3

What you want to do seems straight forward if I’m understanding correctly. You want to detect vibrations but only transmit to IFTTT once per day. The quesitons I would have are:

  1. Are you tracking multiple vibrations and sending an aggregate value? or are you simply sending a boolean indicating if there was movement that day?
  2. Is your 24hour tracking period from 00:00-23:59 (or 12AM to 11:59PM)?
  3. Do you want to transmit at a specific time each day?

Basically you’re doing something like this pseudo-code:

uint32_t lastPubTime = Time.now();

setup() {
    
}

loop() {
    //Detect Vibrations if any.

    //if there was a vibration, increment counter.

    //Check if it is time to publish yet.
    if (lastPublishTime + 24hours >= Time.now()) {

      //Pulish to IFTTT

      //Set lastPublishTime to Time.now().
    }
}


#5

Thank you so much,

I just use 1 vibration sensor to publish and use bool to check if it had sent already.
expect 24h like 00.00~23.59
I don’t need a specific time
I think it works with your solution.