Can not add sensor at trigger

Thank you for taking the time to submit your bug/issue! Please use the points below as a guide when submitting.

  • Device & model you are using (Ex: Pi 2 Model B or Arduino Uno with W5100 ethernet shield)
    Arduino Mega R3 with usb serial connection
  • What dashboard are you using? (Web, iOS, Android)
    Web
  • Please describe the bug / issue as detailed as possible. Attaching the code and any relevant screenshots would be very helpful!
    Please Help…I’m newbie for cayenne world, i want to add some trigger for my sensors, after dragging my device at “if” box, only “State Online/Offline” that appears on the menu option.
    No sensor list at trigger option, all sensor working fine

because all the widgets in your device are actuators and not sensor.

I’m using digital motion sensor, the only actuator in my device is relay switch.

can you share the code and dashboard screenshot .

I’m using code from cayenne sketch file

#include <Adafruit_Sensor.h>
#include <CayenneMQTTSerial.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 3
#define DHTTYPE DHT22
#define VIRTUAL_CHANNEL 4
#define VIRTUAL_CHANNEL1 3
#define ACTUATOR_PIN 5
#define SENSOR_PIN 4

DHT_Unified dht (DHTPIN, DHTTYPE);

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = “c0dfc5c0-4770-11e8-8927-a713813a39dc”;
char password = “4f2757dd88577c48c133cc80231ac94498e0e148”;
char clientID = “3b3e27a0-5741-11e8-86cb-01fd27f5d39c”;

void setup()
{
//Baud rate can be specified by calling Cayenne.begin(username, password, clientID, 9600);
Serial.begin(9600);
Cayenne.begin(username, password, clientID);
dht.begin();
pinMode(ACTUATOR_PIN, OUTPUT);
sensor_t sensor;
}

void loop() {
Cayenne.loop();
checkSensor();
}
int previousState = -1;
int currentState = -1;
unsigned long previousMillis = 0;
// 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.
void checkSensor()
{
unsigned long currentMillis = millis();
// Check sensor data every 150 milliseconds
if (currentMillis - previousMillis >= 150) {
// Check the sensor state and send data when it changes.
currentState = digitalRead(SENSOR_PIN);
if (currentState != previousState) {
Cayenne.virtualWrite(VIRTUAL_CHANNEL, currentState);
previousState = currentState;
}
previousMillis = currentMillis;
}
}
// 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(0, millis());

sensors_event_t event;
dht.temperature().getEvent(&event);
Cayenne.celsiusWrite(1, event.temperature);
dht.humidity().getEvent(&event);
Cayenne.virtualWrite(2, event.relative_humidity, “rel_hum”, “p”);
}

// 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(VIRTUAL_CHANNEL1)
{
// Write value to turn the relay switch on or off. This code assumes you wire your relay as normally open.
if (getValue.asInt() == 0) {
digitalWrite(ACTUATOR_PIN, HIGH);
}
else {
digitalWrite(ACTUATOR_PIN, LOW);
}
}

Hi @saga7o.susanto,

Small bug on our end, we’ll be pushing a hotfix very shortly today.

Thanks

thank you, I appreciate it :smiley:

okay, already fix, now both actuator and sensor are available at trigger option :smiley:
thanks guys for helping me…
cheers :beer: