Custom winget


#1

added custom gauge winget but nothing comes up in settings to adjust or view ranges and selecting corors for ranges at bottom of settings have used it before not sure why it is not coming up


#2

i am not sure why the setting does not open up. can you try this. first delete the widget from the dashbboard. next, add the below lines in your code.

 unsigned long lastMillis = 0;

if (millis() - lastMillis > 10000) {
    lastMillis = millis();
    Cayenne.virtualWrite(1, x, "analog_sensor", "null");
}

where x is the value you want to show on the dashboard.
when you upload the code this will create a temporary widget on your dashboard. add it and click settings. change choose widget to gauge and do the changes you want.


#3

where in code is this placed and do i need to add this for every sensor gauge? Not sure what you mean by x is value i want i callibrated sensors 5 as dry and 615 as wet


#4

can you share the code you are using.


#5

here is my code

 // This example shows how to connect to Cayenne using an Ethernet W5100 shield and send/receive sample data.

//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
//#include <CayenneMQTTEthernet.h>
#include <CayenneMQTTEthernetW5500.h>
 #include <OneWire.h>
#include <DallasTemperature.h>
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "xxxx";
char password[] = "xxxx";
char clientID[] = xxxx";

unsigned long lastMillis = 0;

#define SENSOR_PIN0 A0
#define VIRTUAL_CHANNEL1 1
#define SENSOR_PIN1 A1
#define VIRTUAL_CHANNEL2 2
#define SENSOR_PIN2 A2
#define VIRTUAL_CHANNEL3 3
#define SENSOR_PIN3 A3
#define VIRTUAL_CHANNEL4 4
#define VIRTUAL_CHANNEL5 5
#define VIRTUAL_CHANNEL6 6


// Digital pin the DS18B20 is connected to. Do not use digital pins 0 or 1 since those conflict with the use of Serial.
const int tmpPin6 = 6;
const int tmpPin5 = 5;

OneWire oneWire6(tmpPin6);
OneWire oneWire5(tmpPin5 );  
DallasTemperature sensors6(&oneWire6);
DallasTemperature sensors5(&oneWire5);

void setup()
{
  Serial.begin(9600);
  Cayenne.begin(username, password, clientID);
  sensors5.begin();
  sensors6.begin();
}

void loop()
{
  Cayenne.loop();
}
  // This function is called at intervals to send sensor data to Cayenne.
CAYENNE_OUT(VIRTUAL_CHANNEL5)
{
  // Send the command to get temperatures.
  sensors5.requestTemperatures();
  // This command writes the temperature in Celsius to the Virtual Channel.
  //Cayenne.celsiusWrite(VIRTUAL_CHANNEL, sensors5.getTempCByIndex(0));
  // To send the temperature in Fahrenheit use the corresponding code below.
  Cayenne.fahrenheitWrite(VIRTUAL_CHANNEL5, sensors5.getTempFByIndex(0));
}  
CAYENNE_OUT(VIRTUAL_CHANNEL6) 
{
    // Send the command to get temperatures.
  sensors6.requestTemperatures();
  // This command writes the temperature in Celsius to the Virtual Channel.
  //Cayenne.celsiusWrite(VIRTUAL_CHANNEL, sensors6.getTempCByIndex(0));
  // To send the temperature in Fahrenheit use the corresponding code below.
  Cayenne.fahrenheitWrite(VIRTUAL_CHANNEL6, sensors6.getTempFByIndex(0)); 
  
}
// This function is called at intervals to send sensor data to Cayenne.
CAYENNE_OUT(VIRTUAL_CHANNEL1)
{
  Cayenne.virtualWrite(VIRTUAL_CHANNEL1, analogRead(SENSOR_PIN0));
}
//This function is called at intervals to send sensor datato Cayenne.
CAYENNE_OUT(VIRTUAL_CHANNEL2)
{
  Cayenne.virtualWrite(VIRTUAL_CHANNEL2, analogRead(SENSOR_PIN1));
} 
  //This function is called at intervals to send sensor datato Cayenne.
CAYENNE_OUT(VIRTUAL_CHANNEL3)
{
  Cayenne.virtualWrite(VIRTUAL_CHANNEL3, analogRead(SENSOR_PIN2));
}

  // This function is called at intervals to send sensor data to Cayenne.
CAYENNE_OUT(VIRTUAL_CHANNEL4)
{
   Cayenne.virtualWrite(VIRTUAL_CHANNEL4, analogRead(SENSOR_PIN3));
  
}

#6

did you look over my code still needing gauges with variables and color ranges have not heard back


#7

in your change this :

to

Cayenne.virtualWrite(VIRTUAL_CHANNEL1, analogRead(SENSOR_PIN0), "analog_sensor", "null");

similarly do for others.