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?