Can't add Widgets


#1

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.

Any help would be much appreciated


#2

Can you give us more details? What device are you trying to add them to? What kind of widgets? Just the custom ones or all of them?


#3

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.


#4

Hi thanks for the reply.

I am using an ESP8266 NodeMCU 12E if that helps.

thanks

Steve


#5

How is it connected to Cayenne? Via the Arduino Library or the MQTT Arduino Library? If you’re not sure, share your sketch and we can tell you.

What sort of widget(s) are you trying to add that you’re blocked on?


#6

this is the simple sketch I am using to switch a relay.

I can’t add any widgets from my PC running Windows 10

the add device pull down doesn’t work I just get red circle with a line through.


#7

#include <CayenneMQTTESP8266.h>

const char* ssid = “O***”;
const char* password ="******";

const char* username = "2**6";
const char
mqtt_password = "2**c";
const char
client_id = “1***a”;

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);
}

}

void loop()
{
Cayenne.loop();
}


#8

Update

I just realised I can add the custom widgets but not any of the sensors, actuators.


#9

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.

virtualWrite() expects a parameter format like:

virtualWrite(mqtt_channel_number, value, "type value", "unit value")

A few quick examples:

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:

  1. 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. :slight_smile:

  2. 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.


#10

Excellent thank you so much for your help.


#11

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?


#12

currently Pi agent 2.0 does not support analog and extension. have a look at this Raspberry Pi Agent 2.0