@margettepv made some changes to your code and start with a new device and DO NOT add the widget from dashboard (add new). this code will automatically add a widget. then add the trigger.
int counter = 0;
unsigned long lastMillis = 0;
void setup() {
Serial.begin(9600);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}
void loop() {
Cayenne.loop();
if (millis() - lastMillis > 10000) {
lastMillis = millis();
counter++;
//Write data to Cayenne here. This example just sends the current uptime in milliseconds.
Cayenne.virtualWrite(0, counter);
}
}
// 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”);
}
I followed your provided instructions to add a new NodeMCU ESP8266 device and then tested three trigger variations on it - to fire the Widget button to ON when the set threshold value was reached. When it didn’t fire, I deleted the button widget and created a new button widget using a different channel number, deleted the initial triggers and then recreated new corresponding triggers. They also failed to fire.
Additionally, I deleted one of my REAL devices, updated the motion sensor code with the following: “Cayenne.virtualWrite(motionSMSON, HIGH, “digital_sensor”, “d”);”. I also used the automatically added digital sensor widget for the channel by clicking on the + sign and then created a trigger to fire an SMS when the widget went HIGH. The motion sensor widget on my device DOES properly indicate motion On and Off on the dashboard. However, the trigger does not fire…
Again, I had 10+ triggers set up for my four ESP’s that had worked without error for more than a month. ALL of them simultaneously stopped firing five days ago.
Below is the screenshots from the tests I just completed.
I am new to cayenne, only been on for a week now. I have never been able to get triggers to work. i thought i was doing something wrong but im sure now there is a bug.
The solution that works for me is that it seems that you should use plot for triggering not the meters for example. I mean if you use meters for triggering just add a plot and use the new plot for triggering. It works for me and a little bit strange thing!!!
I was tested the triggers, the text notification. I make if the the temp below -2 C the send me a massge. But it doesnt work, just when i open the app or the we site, then send it. It always need to run in background or need always open the dashboard??? It doesnt good.
I wanna to make a complete ventilaton control system, but it neccesary to run without i Will open the app. For example, need change the ventilator speed belove -5 C to dont freeze the heat exchanger.
What do you think, it would be work or need find something else solution?
Yesterday, I tested an SMS trigger and it worked! Today I went back to test a device to device trigger and that worked! However, the SMS trigger does not seem to be working today.
My earlier SMS test today that failed was on an actuator widget. After remembering that those are no longer usable to trigger an SMS, I tested SMS on a sensor widget and that fired just fine. So all appears good.
Thanks again for the Cayenne platform! Now that MQTT triggers are back in business I’m looking forward to rolling up my sleeves on some more projects.