Trigger is not working


#41

Nope that does not work, here i have set items

Items    
    Temp 1
    Digital Actuator

    Then trigger 1:
    If Temp1 over 40 Then Digital Actuator 1 (On)

    Then set another trigger 2
    If Digital Actuator 1 then Send notifications sms/email

On Temperature change to 40 in Trigger1 Digital Actuator does not change state, if i press Digital Actuator manually it goes to On, and i receive Trigger notification for both SMS/Mail.

So this mode and “combo” does not work, only digital are able to make trigger fire.
Analog to digital does not work internaly, neither analog are recognised when setting up triggers (In app) in web they are recognised, but even if you set them they dont work. So there must be a reason that app is saying that devices with mqtt lib are not usable.

Also the values MIN MAX
14-43-29
reset every time trigger is saved and when i open it it again show min -500 max 500


#42

its just a work around to get a notification to when temp reaches above 40 cause i am not sure why the trigger is not firing. may be @rsiegel can help you out here.
the workaround is in your code add a if condition so as to when temp reaches 40 change the value of two state widget to 1 and then set a trigger when two state widget is 1 send a notification.
on another channel you can show the value of the temp if you want.


#43

Point is, if same process worked with Cayenne Arduino lib, why is not working with MQTT


#44

Some info about this issue?

One more notice:
If you create a trigger using device and save it, then after that you open project page, and select Triggers & Alerts, then edit that same trigger lets say reduce alert temperature by 5c and save, after saving instead of one trigger like before edit there are 2 separate trigers. Is that normal behaviour?


#45

@rsiegel maybe this can help to resolve this issue

I have done some testing today with different hardware and software setups and i have found that device trigger notifications do no recycle PINS USED for it or delete them on server side for some reason.

Case 1 Works:
You setup new device named Device1 mqtt adds channels, you go to trigger and setup notification for some channel/pin to send Email or SMS or both on some event. Its works

Case 2 Does not work:
You go to that same Device1, delete pin/dashboard that was using trigger from previous Case delete trigger for it, after that mqtt adds same pin/dashboard from previous Case. When you now add trigger for that pin which was temporarely deleted, the trigger notification does not work

So evereytime you want to edit trigger, you need edit code for the esp and change pin on which data are sent then add new trigger. Not very practical :anger:

Case tests were made using mqttesp lib and stand-alone esp module reading temperature values from 3 different sensors and writing valuse of them to 3 different cayenne pins.


Trigger nor working in some cases
#46

Definitely seems like a bug. I will test it out now and post back if I get the same results. Thanks for putting so much detail in to this report!


#47

Confirmed.

  1. create mqtt device
  2. connect to it (sketch below)
  3. add temp widgets with +
  4. create trigger when channel 5 is over 10 turn on channel 6
  5. delete channel 5 (has to be the source of the trigger, deleting destination doesn’t cause this bug)
  6. delete trigger
  7. add widget with + again
  8. recreate trigger
  9. trigger doesn’t ever fire

Code:

// 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>

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

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "";
char password[] = "";
char clientID[] = "";

int counter = 0;

unsigned long lastMillis = 0;

void setup() {
	Serial.begin(9600);
	Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}

void loop() {
	Cayenne.loop();
  delay(1000);
  counter++;
}

// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
	// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
	Cayenne.virtualWrite(5, counter, "analog_sensor", "null");
	// Some examples of other functions you can use to send data.
	//Cayenne.celsiusWrite(1, 22.0);
	//Cayenne.luxWrite(2, 700);
	//Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
 Cayenne.virtualWrite(6, 0, "digital_actuator", "d");
}

// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
	CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString());
	//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");
}

#48

Also worth noting I has some weird issues with the deleted channels sticking around for a bit:


#49

@adam Same situation here, deleted or renamed they still hang around for a few minutes, probably until synchronisation is done, but that is not a big issue since it goes by it self.

This triggers are more of a issue, i am glad or not :smile: that you were able to reproduce this bug, i would be more happy if you did not so i could blame it on my fast fingers or extra bracket in the code, but :tired_face: its not. I did not have this issues with arduino library it poped up when transfered to mqtt.


Triggers are not working for "bring your own thing Cayenne MQTT"