I am trying to add widgets to my dashboard, when I select the widget the and get to the enter settings section, the select device option is greyed out and I get a red circle with a line through.
If I run the app on my phone it works ok and I can add widgets, but very limited.
Hi @stevepage64 and welcome to the Cayenne Community.
I don’t want to speculate too much without more information of the type Julian asked for, but I suspect there is a logical reason for this once we know the device/widget types.
For example, the Custom Widgets he mentioned right now are for Arduino and MQTT/‘Bring Your Own Thing’ connected devices at the moment, so it’s intended that you wouldn’t be able to add them to a Raspberry Pi or LoRa device in the current design. If this is the specific case, you can connect your Pi through the MQTT API to take advantage of them using our Cayenne MQTT Python client.
There are probably a handful of other ‘gotcha’ situations like this in the product, so I’ll let you share a little more detail and then should be able to address.
void setup() {
// put your setup code here, to run once:
Cayenne.begin(username, mqtt_password, client_id, ssid, password);
pinMode(D4, OUTPUT);
}
CAYENNE_IN(8)
{
// get value sent from dashboard
int currentValue = getValue.asInt(); // 0 to 1
Serial.print (currentValue);
// assuming you wire your relay as normally open
if (currentValue == 1) {
digitalWrite(D4, LOW);
} else {
digitalWrite(D4, HIGH);
}
Ok, I understand what’s up now. We could probably make this clearer in our UI, but the widget creation process is a little different for MQTT-connected devices.
For all MQTT sensor data, instead of adding the widget, and then feeding it with data, you do it the other way around – publish the sensor values to Cayenne in your code using virtualWrite(), and we’ll auto-create temporary widgets on your dashboard which you can then accept and customize.
Pass temperature value 25.2 in Celsius to MQTT Channel 2 virtualWrite(2, 25.2, "temp", "c")
Pass generic value 17.222 to MQTT Channel 6 virtualWrite(6, 17.222, "analog_sensor", "null")
Digital 2-state value 1 on channel 5: virtualWrite(5, 1, "digital_sensor", "d")
You can use the chart in this thread to help you build these statements for other data/unit types. I’d be happy to help in that regard as well.
For MQTT Actuators (like a relay), the process is a little different:
First create a custom button or slider widget – as you’ve noticed, this is one of the few things that was not blocked for you. Don’t worry about the ‘Relay’ widget you may have found digging in menus – it’s just a dolled up button widget and you can customize your custom button widget the same way.
Add code to a CAYENNE_IN(x) block where x == the channel you selected for the custom widget in step 1. It looks like you basically have this in place already, presuming your button is set to channel 8.
Hi!, I’m new to cayene and just linked my RPi3 to cayenne but i’m not able to add nothing, not a sensor, not even a mcp3008. how can I add analog sensors to cayenne using Raspberry Pi?