Triggers #126

Closed
pjudkins opened this Issue Mar 8, 2016 · 8 comments

Projects

None yet

6 participants

@pjudkins
pjudkins commented Mar 8, 2016

I have a trigger set up to email me a temperature every four hours but it sends an email every 11 minutes. It does the same no matter what time frame I set up

@sajogrozni

Same here. No matter the trigger settings I get email every 11 minutes.

@jwcooper
Member

We're temporarily disabling the email triggers until we can make them more robust in a near future update. In the meantime, the alternative would be to use our IFTT channel, which can do pretty much the same thing as our internal trigger emails.

@phlemoine

I am looking for a way to trigger at a specific time in the day... how can I set up the time the trigger starts ? Same for a 12 hours or even 4 hours ...

@jwcooper
Member
jwcooper commented Jul 8, 2016

We don't have that functionality built-in right now. IFTTT may do that (we have a channel)? This is a feature we'll consider when we revamp the existing triggers.

@phlemoine

IFTTT or even Zapier only allow one trigger, in my case , I need two... one for time and one for reading the feed... I am left with developing my own solution :)

@toddtreece
Member

@phlemoine not sure if this will help, but here's an example of triggering from a sketch using the latest version of the adafruit mqtt library with the esp8266 feather or breakout. you will just need to replace the Serial.println("Run your code here"); line with your code.

#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"

/************************* WiFi Access Point *********************************/
#define WLAN_SSID       "network"
#define WLAN_PASS       "password"

/************************* Adafruit.io Setup *********************************/
#define AIO_SERVER      "io.adafruit.com"
#define AIO_SERVERPORT  1883
#define AIO_USERNAME    "user"
#define AIO_KEY         "key"

WiFiClient client;
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_USERNAME, AIO_KEY);

Adafruit_MQTT_Subscribe timefeed = Adafruit_MQTT_Subscribe(&mqtt, "time/seconds");

// set timezone offset from UTC
int timeZone = -4; // UTC - 4 eastern daylight time (nyc)
int interval = 4; // trigger every X hours
int hour = 0;

void timecallback(uint32_t current) {

  // stash previous hour
  int previous = hour;

  // adjust to local time zone
  current += (timeZone * 60 * 60);

  // calculate current hour
  hour = (current / 60 / 60) % 24;

  // only trigger on interval
  if((hour != previous) && (hour % interval) == 0) {
    Serial.println("Run your code here");
  }

}

void setup() {

  Serial.begin(115200);
  delay(10);

  Serial.print(F("Adafruit IO Time Demo"));

  WiFi.begin(WLAN_SSID, WLAN_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(F("."));
  }
  Serial.println(F(" WiFi connected."));

  timefeed.setCallback(timecallback);
  mqtt.subscribe(&timefeed);

}

void loop() {

  int8_t code;

  // connect to adafruit io if not connected
  if(! mqtt.connected()) {

    Serial.print("Connecting to Adafruit IO... ");
    if((code = mqtt.connect()) != 0) {
      Serial.println(mqtt.connectErrorString(code));
      while(1);
    }
    Serial.println("connected!");

  }

  mqtt.processPackets(1000);
  mqtt.ping();

}
@mlinaje
mlinaje commented Dec 20, 2016

Creating a trigger throw an AJAX error in my case (chrome last regular version).

@jwcooper
Member

We still have plans to re-work our triggers. The javascript errors should be resolved with our latest UI update.

If this is still an issue, can you post the updated details to our forum? We're consolidating our issues and enhancement requests.

https://forums.adafruit.com/viewforum.php?f=56

@jwcooper jwcooper closed this Jan 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment