I am using an 8266 to send an analog value 0 to 1024 on channel 0, just using a pot. The value is updating ok on the overview page. i created some triggers to be sent via text and email and it seemed intuitive to set them up but none are working. I created high and low set-points and a threshold of 500. I also set an online/offline trigger. I can move the pot but no alerts are sent. What am i doing wrong?
//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>
int analogPin = A0;
int pot = 0;
// WiFi network info.
char ssid = “cleo****”;
char wifiPassword = “Bulls***”;
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = “9d5fb8c0-bf04-11e7-993a-9b80361bb***”;
char password = “d50e5910dfd7068eae12858a7b3e47272086f***”;
char clientID = “b8af2570-bf04-11e7-b1f7-559b31b83***”;
unsigned long lastMillis = 0;
void setup() {
Serial.begin(9600);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}
void loop() {
Cayenne.loop();
pot = analogRead(analogPin); // read the input pin
// //Publish data every 10 seconds (10000 milliseconds). Change this value to publish at a different interval.
if (millis() - lastMillis > 1000)
{
lastMillis = millis();
// //Write data to Cayenne here. This example just sends the current uptime in milliseconds.
Cayenne.virtualWrite(0, pot, “analog_sensor”, “null”);
Serial.println (pot);
// //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);
}
}
//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(“CAYENNE_IN_DEFAULT(%u) - %s, %s”, request.channel, getValue.getId(), getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
}