Triggers not working /have to restart app ALWAYS

As the title says, the triggers won’t work (smartphone side - from pc browser ok)
I always need to restart the app everytime I need to control a relay /switch. The icon animates but nothing happens. Then I restart the app and it works. It’s quite frustrating

// This example shows how to connect to Cayenne using an ESP8266 and send/receive sample data.
// Make sure you install the ESP8266 Board Package via the Arduino IDE Board Manager and select the correct ESP8266 board before compiling. 

#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>
#include <Adafruit_BMP085_U.h>
#include <SimpleTimer.h>
#include <SPI.h> 



//BUTTON declarations
SimpleTimer timer;
const int buttonPin = D8;  // The number of the Pushbutton pin
int buttonState = 0;  // Variable for reading the pushbutton status
long previousMillis = 0;        // will store last time LED was updated
long interval = 3000;           // interval at which to blink (milliseconds)
long currentValue;
float Dtemp;


// WiFi network info.
char ssid[] = "";
char wifiPassword[] = "";


// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.


//ALARM RELAY
#define VIRTUAL_CHANNEL 2
#define ACTUATOR_PIN D2 // This button opens connection on the alarm remote control

//BIG GATE GATE RELAY
#define VIRTUAL_CHANNEL 3
#define ACTUATOR_PIN D3 // This button opens connection on the garage gate remote control




unsigned long lastMillis = 0;

void setup() {
  Serial.begin(74880);
  timer.setInterval(1200L, emergencybtn);
  
  Cayenne.begin(username, password, clientID, ssid, wifiPassword);

  //SETUP WINDOW DOOR AS HIGH (default locked)
  digitalWrite(D5, HIGH);
  pinMode(D5, OUTPUT);
  
  //SETUP ALARM AS HIGH (default not pressed)
  digitalWrite(D2, HIGH);
  pinMode(D2, OUTPUT);

        //SETUP BIG GATE AS HIGH (default  not pressed)
  digitalWrite(D3, HIGH);
  pinMode(D3, OUTPUT);
    
}



void loop()  
{
         
          Cayenne.loop(); 
          timer.run();
          Serial.print("   Online   ");         
          

}

void emergencybtn()
  {   
   //REDBUTTON EMERGENCY
   previousMillis = millis();
 
   // read the state of the pushbutton value:
   buttonState = digitalRead(buttonPin);

   //The button is pushed
    while (buttonState == HIGH) 
           

  {

       Serial.println(buttonState);
     
     currentValue = millis() - previousMillis;
    
     if (currentValue > interval)  //If pushbutton is over 7 secs, let someone in
     {          
       // save the last time relays has been turned on
       previousMillis = millis();   
       
       digitalWrite(D5, LOW);      //opendoor
       delay(2000);     //give time to turn the handle and open the door 
      digitalWrite(D5, HIGH);    //close it
     
     }
  
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);
  yield();
    }
  
  }


// DOOR RELAY   This function is called when data is sent from Cayenne.
CAYENNE_IN(1)
{
  // Mosfet cut current to open door
  if (getValue.asInt() == 0) {
    digitalWrite(D5, LOW);
    delay(2200);
     digitalWrite(D5, HIGH);
  }
  else {
    digitalWrite(D5, HIGH);
  }
}


// ALARM RELAY This function is called when data is sent from Cayenne.
CAYENNE_IN(2)
{
  // Needs almost 1 sec press to activate/deactivate remote control.
  if (getValue.asInt() == 0) {
    digitalWrite(D2, LOW);
    delay(800);
    digitalWrite(D2, HIGH);
  }
  else {
    digitalWrite(D2, HIGH);
    
  }
}


// AUTOMATIC PORCH GATE RELAY This function is called when data is sent from Cayenne.
CAYENNE_IN(3)
{
  // Needs almost 2 sec press to activate/deactivate remote control
  if (getValue.asInt() == 0) {
    digitalWrite(D3, LOW);
    delay(1900);
    digitalWrite(D3, HIGH);
  }
  else {
    digitalWrite(D3, HIGH);
    
  }
}

CAYENNE_OUT (13)
{
Cayenne.virtualWrite(0, millis());
}

we are looking into this issue.

Did a rollback to 1.5.2 and it seems ok
Seems that something happened between 1.5.2 and 1.5.3

1 Like

thanks for the details.